Jenkins, specifying JAVA_HOME

NimChimpsky picture NimChimpsky · Nov 18, 2011 · Viewed 113k times · Source

I installed openjdk-6-jdk on my ubuntu box using apt-get.

In system info jenkins is telling me Java.Home is /usr/lib/jvm/java-6-openjdk/jre

However when I specify that directory as JAVA_HOME in Jenkins : "configure system", it returns error message saying that directory does not look like a jdk directory.

it is also failing to pick up my maven install.

Am I missing something obvious ?

Answer

Ernesto Campohermoso picture Ernesto Campohermoso · Nov 18, 2011

Your JAVA_HOME variable must be set to /usr/lib/jvm/java-6-openjdk and it must be available for the user that starts Jenkins.

From Kyle Strand comment:

As of April 2015 (I think), Jenkins requires Java7. Also note that the java binary path (JAVA) must be set to the correct version if the system default is still Java 6. Finally, for anyone wondering where these variables are set, it's in a config file listed with the installation instructions on the Jenkins webpage (e.g. for Debian it's /etc/default/jenkins).