Can we add two Java versions in one Jenkins?

2.6k Views Asked by At

Recently I have worked on integrating remote Websphere Application Server with Jenkins. The server was running on java 1.6 and Jenkins with java 1.7 in my machine. I have faced an exception called ClassChangeErrorException. I have resolved it by changing Jenkins java version to 1.6. My question is can I have two java versions in one Jenkins?

2

There are 2 best solutions below

1
On

Yes, you can:

  1. Define two jdks in Manage Jenkins -> Configure System -> JDK installations:

enter image description here

  1. Specify needed jdk in job configuration:

enter image description here

0
On

You can set the Java Versions available Globally through <jenkins_url>/configureTools/ after version 2.0 or <jenkins_url>/configure before version 2.0.

Source: https://support.cloudbees.com/hc/en-us/articles/204960114-How-to-set-the-available-JDK-versions-