Reputation: 73
My Jenkins is hosted on a Linux server but when I type echo $JAVA_HOME on Linux it is empty but my Jenkins stated "/usr/lib/jvm/java-8-openjdk-amd64"
Attempt method:
Set JDK in Global Tool Configuration
-Name JAVA
-JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64
->ERROR:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64 is not a directory on the Jenkins master (but perhaps it exists on some agents)
-Add JDK
-Tick Install automatically
-Name JAVA
-Add Installer, Extract .zip/.tar.gz
-Label JAVA
-Download URL for binary "https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz"
unknown error: cannot find Chrome binary
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '8f5b40c32460', ip: '172.18.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver
Linux cmd
javac -version
javac 1.8.0_242
java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
Upvotes: 1
Views: 4854
Reputation: 434
Go to manage Jenkins and then global tool location search for Java and add variable name as JAVA_HOME and value as "pathof Jdk/bin/" save it.
Upvotes: 0
Reputation: 1469
Since you already have java installed in the jenkins instance, you just have to point the configuration to the right directory (Fill in the JAVA_HOME property below).
Seems like "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64" is not the correct directory. You can find your JDK location using the following command:
readlink -f $(which java)
Upvotes: 0