0
votes

I'm trying to configure Jenkins with Java 1.6, 1.7 and 1.8.

$ update-alternatives --config java
Há 3 programas que oferecem "java".
Seleção    Comando
-----------------------------------------------
*+ 1           /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el7_2.x86_64/jre/bin/java
  2           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.101-2.6.6.1.0.1.el7_2.x86_64/jre/bin/java
  3           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

As you can see the Java installation are ok. But I can configure only Java 1.8 and 1.7 on jenkins Global Tool Configuration.

jenkins can not find the installation of java 1.6

/usr/lib/jvm/jre-1.6.0-openjdk.x86_64 not look like a jdk directory

2
You provided a jre directory rather than jdk. You need to provide a valid jdk directory. - Avihoo Mamka
Thanks, I just copy paste the result of alternatives --config java on jenkins configuration and I did not realize this mistake. Put this comment as answer please. - Joao Vitorino

2 Answers

3
votes

The jenkins JAVA_HOME parameter in the JDK section expects to a valid JDK directory.

You provided a JRE directory and therefore your mistake.

Simply replace the value to the JDK directory of your Java 1.6 installation.

More info about JDK vs. JRE click here

0
votes

You got the answer, Joao Vitorino.

/usr/lib/jvm/jre-1.6.0-openjdk.x86_64

is not a jdk directory, it is a jre directory.

You can try out with(asuming you are using ubuntu)

$ sudo apt-get install openjdk-6

to install jdk 1.6

refer: http://openjdk.java.net/install/