[英]Jenkins / Maven: Could not resolve default JAVA_HOME path, Build failing
I've got a problem regarding Java Builds in Jenkins. 关于Jenkins中的Java Builds我遇到了问题。
The Error I resolve is the following one: 我解决的错误如下:
Unable to locate the Javac Compiler in: C:\\Jenkins\\jre\\..\\lib\\tools.jar Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required). In most cases you can change the location of your Java installation by setting the JAVA_HOME environment variable.
I got JDK1.6
and JDK1.7
projects, so I need two JDK installations. 我得到了
JDK1.6
和JDK1.7
项目,所以我需要安装两个JDK。 For my default Java JDK I used the 1.6 for the JAVA_HOME
variable, which points to C:\\Program Files\\Java\\jdk1.6.0_45
. 对于我的默认Java JDK,我使用1.6作为
JAVA_HOME
变量,它指向C:\\Program Files\\Java\\jdk1.6.0_45
。 Same for the 1.7 version, but in a separated variable ( JAVA_HOME7
). 1.7版本相同,但是在一个单独的变量(
JAVA_HOME7
)中。 The PATH
variable contains the appended \\bin
to the two JDK versions. PATH
变量包含两个JDK版本的附加\\bin
。
In Jenkins I also added both versions for JDK and as helper variables. 在Jenkins中,我还为JDK添加了两个版本,并添加了辅助变量。 If I am setting a concrete version for a project (eg
JDK1.7
), then it's building without any issues. 如果我正在为项目设置具体版本(例如
JDK1.7
),那么它的构建没有任何问题。 Unfortunately I've got a lot of build-projects, so it would be time consuming to set this manually. 不幸的是,我有很多构建项目,所以手动设置它会很费时间。
I don't understand where the call or variable for the path of the error C:\\Jenkins\\jre\\..\\lib\\tools.jar
is set and where I can modify it... 我不明白错误
C:\\Jenkins\\jre\\..\\lib\\tools.jar
的路径的调用或变量在哪里设置,我可以在哪里修改它...
Jenkins Version: 1.509.4 詹金斯版本:1.509.4
Any hints or advices how to solve this problem? 任何提示或建议如何解决这个问题?
I faced the same problem. 我遇到了同样的问题。 The below steps solved the problem
以下步骤解决了这个问题
1) Go to Manage Jenkins - Configure system 1)转到管理Jenkins - 配置系统
2) Add JAVA_HOME and its path in Global Properties - Environment Variables 2)在全局属性 - 环境变量中添加JAVA_HOME及其路径
3) Add JDK and path in JDK section 3)在JDK部分添加JDK和路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.