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] 连接关闭。如下图所示为报错图:

jenkins连接虚拟机里面的centos7报错: Checking java version of /usr/local/java/bin/java Couldn't figure out the

我的centos7虚拟机成功安装了java的jdk1.8,但是为什么找不到呢?有人说用软连接,我在机器里面用软连接也不行,网上的帖子解决不了。其实呢!

原因很简单就是找不到虚拟机里面的java安装路径,在配置机器的时候,添加上java的如下路径即可:

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

如下图所示:

 

jenkins连接虚拟机里面的centos7报错: Checking java version of /usr/local/java/bin/java Couldn't figure out thejenkins连接虚拟机里面的centos7报错: Checking java version of /usr/local/java/bin/java Couldn't figure out the

或者你的路径和我的不一样,也可以是这个方式:

jenkins连接虚拟机里面的centos7报错: Checking java version of /usr/local/java/bin/java Couldn't figure out the