简体   繁体   English

无法设置 Jenkins 的 JAVA_HOME 路径

[英]Unable to set Jenkins' JAVA_HOME path

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"我的 Jenkins 托管在 Linux 服务器上,但是当我在 Linux 上键入 echo $JAVA_HOME 时它是空的,但我的 Jenkins 指出“/usr/lib/jvm/java-8-openjdk-amd64”

Attempt method:尝试方法:
Set JDK in Global Tool Configuration在全局工具配置中设置 JDK
-Name JAVA -名称JAVA
-JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64 -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) ->ERROR:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64 不是 Jenkins master 上的目录(但也许它存在于某些代理上)

-Add JDK - 添加JDK
-Tick Install automatically -Name JAVA -勾选自动安装 -Name JAVA
-Add Installer, Extract .zip/ .tar.gz - 添加安装程序,解压.zip/ .tar.gz
-Label JAVA -标签JAVA
-Download URL for binary " https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz " -下载二进制文件“ 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 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)

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).由于您已经在 jenkins 实例中安装了 java,您只需要将配置指向正确的目录(填写下面的JAVA_HOME属性)。

在此处输入图片说明

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.似乎“ /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64 ”不是正确的目录。 You can find your JDK location using the following command:您可以使用以下命令找到您的 JDK 位置

readlink -f $(which java)

转到管理 Jenkins 然后全局工具位置搜索 Java 并将变量名称添加为 JAVA_HOME 并将值添加为“pathof Jdk/bin/”保存它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM