0

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

Tom
  • 16,842
  • 17
  • 45
  • 54
Joao Vitorino
  • 2,976
  • 3
  • 26
  • 55
  • 1
    You provided a `jre` directory rather than `jdk`. You need to provide a valid `jdk` directory. – Avihoo Mamka Jul 19 '16 at 14:59
  • 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 Jul 19 '16 at 15:09

2 Answers2

3

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

Community
  • 1
  • 1
Avihoo Mamka
  • 4,656
  • 3
  • 31
  • 44
0

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/

shitoujizu
  • 69
  • 1
  • 9