首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Jenkins:找不到javac编译器

Jenkins:找不到javac编译器
EN

Stack Overflow用户
提问于 2018-09-12 01:48:26
回答 2查看 1.5K关注 0票数 -1

我在Jenkins中运行作业,运行时出现以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run
        (deploy-artifact) on project SoapOCPTestingPOC: An Ant BuildException has occured:
        The following error occurred while executing this line:
[ERROR] C:\Arun\SoapAutomation\et-ocp-automation\build.xml:37: Unable to find a javac compiler;
[ERROR] com.sun.tools.javac.Main is not on the classpath.
[ERROR] Perhaps JAVA_HOME does not point to the JDK.
[ERROR] It is currently set to "C:\Program Files\Java\jdk1.8.0_181\jre"
[ERROR] around Ant part ...<ant antfile="C:\Arun\SoapAutomation\et-ocp-automation\build.xml">
        ... @ 4:69 in C:\Arun\SoapAutomation\et-ocp-automation\target\antrun\build-main.xml
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

我有Java home:C:\Program Files\Java\jdk1.8.0_181

我已经尝试了一些可能的方法。但是我想不出来。

EN

回答 2

Stack Overflow用户

发布于 2018-09-12 03:30:41

看起来你的JAVA_HOME指向的是C:\Program Files\Java\jdk1.8.0_181\jre而不是C:\Program Files\Java\jdk1.8.0_181

在环境变量中设置它

Linux:How to set JAVA_HOME in Linux for all users

Windows:How to set java_home on Windows 7?

然后打开命令提示符,尝试打印JAVA_HOME以检查其值。

我想这应该能解决你的问题。

票数 0
EN

Stack Overflow用户

发布于 2018-09-26 21:17:02

最近在我们的一个构建服务器上遇到了类似的问题,来自ant:

C:\BuildTools\Android\android-sdk\tools\ant\build.xml:730: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_181"

尽管SET JAVA_HOME报道了这一点

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181

我们今天通过重启有问题的服务器(Windows Server2012 R2)解决了这个问题,所以我只能建议您尝试相同的操作过程。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52281541

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档