Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (29.3k points)

we have configured a couple of JDKs in our Jenkins, which are: JDK8, JDK9, JDK11, etc. The Jenkins itself is running under JDK8. Now, we want to get Jenkins to use JDK9 in all Pipelines if the "tools" statement isn't in pipeline's definition. Is there a way to do that?

1 Answer

0 votes
by (50.2k points)

Defining a JAVA_HOME environment variable in the Jenkins environment will be enough:

export JAVA_HOME = /path/to/JDK9

if you run Jenkins in a container, just define JAVA_HOME in the docker run command:

docker run -d -p 8080:8080 -p 50000:50000 -v /path/to/JDK9:/internal/path/to/JDK9 --env JAVA_HOME=/internal/path/to/JDK9 jenkins:jenkins

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...