Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
500 views
in Technique[技术] by (71.8m points)

java - Jenkins / Maven: Could not resolve default JAVA_HOME path, Build failing

I've got a problem regarding Java Builds in Jenkins.

The Error I resolve is the following one:

Unable to locate the Javac Compiler in: C:Jenkinsjre..libools.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. For my default Java JDK I used the 1.6 for the JAVA_HOME variable, which points to C:Program FilesJavajdk1.6.0_45. Same for the 1.7 version, but in a separated variable (JAVA_HOME7). The PATH variable contains the appended in to the two JDK versions.

In Jenkins I also added both versions for JDK and as helper variables. If I am setting a concrete version for a project (e.g. JDK1.7), then it's building without any issues. 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:Jenkinsjre..libools.jar is set and where I can modify it...

Jenkins Version: 1.509.4

Any hints or advices how to solve this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I faced the same problem. The below steps solved the problem

1) Go to Manage Jenkins - Configure system

2) Add JAVA_HOME and its path in Global Properties - Environment Variables

3) Add JDK and path in JDK section


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...