java.io.IOException: Cannot run program "/opt/jdk1.8.0_191/bin/java" (in directory "/

Posted winstom

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java.io.IOException: Cannot run program "/opt/jdk1.8.0_191/bin/java" (in directory "/相关的知识,希望对你有一定的参考价值。

测试jenkins构建,报错如下

Parsing POMs
Established TCP socket on 44463
[xinguan] $ /opt/jdk1.8.0_191/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/opt/maven-3.6/boot/plexus-classworlds-2.5.2.jar:/opt/maven-3.6/conf/logging jenkins.maven3.agent.Maven35Main /opt/maven-3.6 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.33.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 44463
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/opt/jdk1.8.0_191/bin/java" (in directory "/var/lib/jenkins/workspace/xinguan"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at hudson.Proc$LocalProc.<init>(Proc.java:250)
    at hudson.Proc$LocalProc.<init>(Proc.java:219)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:937)
    at hudson.Launcher$ProcStarter.start(Launcher.java:455)
    at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
    at hudson.maven.ProcessCache.get(ProcessCache.java:236)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:804)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1815)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 12 more
Finished: FAILURE

手动确定了 /opt/jdk1.8.0_191/bin/java/var/lib/jenkins/workspace/xinguan 都是正常存在的目录,但还是报错没有文件或目录

于是乎手动执行了一下上面提示的命令:

[root@harbor jdk1.8.0_191]# /opt/jdk1.8.0_191/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/opt/maven-3.6/boot/plexus-classworlds-2.5.2.jar:/opt/maven-3.6/conf/logging jenkins.maven3.agent.Maven35Main /opt/maven-3.6 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.33.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar
-bash: /opt/jdk1.8.0_191/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

哦吼,问题出来了,缺少依赖包glibc.i686,安装

yum install glibc.i686 -y

以上是关于java.io.IOException: Cannot run program "/opt/jdk1.8.0_191/bin/java" (in directory "/的主要内容,如果未能解决你的问题,请参考以下文章

java.io.IOException: toDerInputStream 拒绝标签类型 77

java.io.IOException:系统找不到指定的路径

java.io.IOException: Connection reset by peer和java.io.IOException: Connection timed out。Socket

android java.io.IOException:传输端点未连接

任务 ':app:compileDebugKotlin' java.io.IOException 执行失败

火花:java.io.IOException:设备上没有剩余空间[再次!]