jenkins連接虛擬機裏面的centos7報錯: Checking java version of /usr/local/java/bin/java Couldn't figure out the

安裝在win10上的jenkins,去連接virtual box虛擬機centos7報錯:
[07/14/18 23:49:44] [SSH] Checking java version of java
Couldn't figure out the Java version of java
bash: java: command not found

[07/14/18 23:49:44] [SSH] Checking java version of /usr/bin/java
Couldn't figure out the Java version of /usr/bin/java
bash: /usr/bin/java: No such file or directory

[07/14/18 23:49:44] [SSH] Checking java version of /usr/java/default/bin/java
Couldn't figure out the Java version of /usr/java/default/bin/java
bash: /usr/java/default/bin/java: No such file or directory

[07/14/18 23:49:45] [SSH] Checking java version of /usr/java/latest/bin/java
Couldn't figure out the Java version of /usr/java/latest/bin/java
bash: /usr/java/latest/bin/java: No such file or directory

[07/14/18 23:49:45] [SSH] Checking java version of /usr/local/bin/java
Couldn't figure out the Java version of /usr/local/bin/java
bash: /usr/local/bin/java: No such file or directory

[07/14/18 23:49:45] [SSH] Checking java version of /usr/local/java/bin/java
Couldn't figure out the Java version of /usr/local/java/bin/java
bash: /usr/local/java/bin/java: No such file or directory

[07/14/18 23:49:45] [SSH] Checking java version of /root/.jenkins/jdk/bin/java
Couldn't figure out the Java version of /root/.jenkins/jdk/bin/java
bash: /root/.jenkins/jdk/bin/java: No such file or directory

Linux wxiaohui-ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Installing JDK jdk-8u144-oth-JPR
Downloading JDK from http://download.oracle.com/otn/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gzOracle now requires Oracle account to download previous versions of JDK. Please specify your Oracle account username/password.java.io.IOException: Could not find any known supported java version (a minimum level of 8 is required) in [java, /usr/bin/java, /usr/java/default/bin/java, /usr/java/latest/bin/java, /usr/local/bin/java, /usr/local/java/bin/java, /root/.jenkins/jdk/bin/java], and we also failed to install JDK as a fallback
at hudson.plugins.sshslaves.SSHLauncher.resolveJava(SSHLauncher.java:954)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:836)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:820)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: hudson.AbortException: Unable to install JDK unless a valid Oracle account username/password is provided in the system configuration.
at hudson.tools.JDKInstaller.locate(JDKInstaller.java:539)
at hudson.plugins.sshslaves.SSHLauncher.attemptToInstallJDK(SSHLauncher.java:1075)
at hudson.plugins.sshslaves.SSHLauncher.resolveJava(SSHLauncher.java:951)
... 6 more
[07/14/18 23:49:48] Launch failed - cleaning up connection
[07/14/18 23:49:48] [SSH] 連接關閉。如下圖所示爲報錯圖:

我的centos7虛擬機成功安裝了java的jdk1.8,但是爲什麼找不到呢?有人說用軟連接,我在機器裏面用軟連接也不行,網上的帖子解決不了。其實呢!

原因很簡單就是找不到虛擬機裏面的java安裝路徑,在配置機器的時候,添加上java的如下路徑即可:

/usr/local/java/jdk1.8.0_211/bin/java

如下圖所示:

 

或者你的路徑和我的不一樣,也可以是這個方式:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章