I'm trying to get Jenkins work on Windows machine. For testing purpose I've installed Jenkins on my localhost. Java_home
and path
are pointing to java 14(Extracted from zip). I had jre7 and jre 8 installed on my machine so removed them to get rid of the classpath errors i had earlier. I had to manually delete java.exe javaw.exe from the system32 folder.
I run ant build from command prompt, it works without any issues. Now I build the same project in Jenkins which is also on the same machine, i get the following exception.
Where do I specify the Java version within Jenkins so it starts using the JAVA_HOME and Path?
[CommonUtilities] $ cmd.exe /C '"ant.bat -file exported_build.xml build && exit %%ERRORLEVEL%%"'
Error: could not open `C:\Program Files (x86)\Java\jre7\lib\i386\jvm.cfg'
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
Update:
>echo %JAVA_HOME%
C:\tools\bea\jdk142_19
>echo %PATH%
C:\TDS\Ora\product\11.2.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\W
indowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\tools\bea\jdk142_08\b
in;C:\tools\Build\ant\apache-ant-1.8.2\bin;
To change default Jenkins JRE, edit the configuration file %JENKINS_HOME%/jenkins.xml , and modify <executable>
tag with your preferred JRE path, like this:
<!-- <executable>%BASE%\jre\bin\java</executable> -->
<executable>C:\Program Files\Java\jdk1.8.0_65\jre\bin\java</executable>
Are you using the Winstone Application server? Is the correct java binary in your %PATH%
?
If you're using the Winstone Application Server, it's not hard to get the correct java to run. You give it the path name. Otherwise, make sure that the JRE bin directory is in your %PATH%
.
C:\> \path\to\java\JRE\bin\java -jar jenkins.jar
I had to manually delete java.exe javaw.exe from the system32 folder.
Noooooooo! Never delete anything in the System32 directory from Windows. If possible, use the Software uninstaller in the Control Panel. Windows uses the registry to register all of the components that were installed and needed. If you can't install the default Java, then simply put the %JAVA_HOME%\\bin
in your %PATH%
before the C:\\Windows\\System 32
directory
I suggest to use the Winstore application server that comes embedded in Jenkins for testing. Just run it from the command line in a Console window like I show above. Once you test it, you can install Jenkins as a Windows Service , so Jenkins will automatically startup when you start your machine, and it will run under a service account and restart itself if for some reason the service goes down.
What I did:
JAVA_HOME_1.6
, JAVA_HOME_1.7
. JAVA_HOME
environment variable that points to one of the above JAVA_HOME versions I created in the previous step. PATH
to have %JAVA_HOME\\bin
as the first element in the PATH. If I need to change which Java version I am using, I simply change my JAVA_HOME
definition and open a new Console window. Now, the right version of Java is in my path, I can start Jenkins like this:
C> java -jar jenkins.war
Symptom: Jenkins service starts and immediately stops.
Jenkins.wrapper.log has a line indicating the incorrect path to Java: - Starting C:\\Program Files\\Java\\jre1.8.0_141\\bin\\java -Xrs -Xmx6g -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\\Program Files (x86)\\Jenkins\\jenkins.war" --httpPort=8080 --webroot="C:\\Program Files (x86)\\Jenkins\\war"
The fix: Jenkins has the path hard-coded in jenkins.xml. Change the path to the new Java location. In my case I changed: C:\\Program Files\\Java\\jre1.8.0_141\\bin\\java to C:\\Program Files\\Java\\jre1.8.0_171\\bin\\java
You can also use Windows Environment Variables, but I wasn't successful with that and I don't think the Java installer updates those, so you'd need to update that by hand every time anyway.
Windows Server 2008 R2 Standard, SP1 Jenkins 2.89.4 Java version 8.171
Your %JAVA_HOME% and the only thing on your %PATH% environment variable that looks like Java is set to 'C:\\tools\\bea\\jdk142_19' or 'C:\\tools\\bea\\jdk142_08', and I think those are going to be java 1.4.2. Change your system environment variables to point to the JDK or JRE install that lives in your Program Files directory, and Jenkins will start using that JRE. Getting Jenkins to use a specific JDK for builds is a different matter, which has been asked and answered elsewhere.
I had Jdk15 version still sitting around in the program files, I had to delete it then restart my system. Jenkins picked up the jdk14 from the path and ran successfully.
Another suggestion:
If you changed your environment after installing Jenkins (removed Java, changed path, etc,) it won't be relevant to Jenkins as it's already under a session where it got its environment. restart Jenkins for those changes to take effect and to load the new environment to the session.
I had the same issue. Just Install the latest version of Java. Restart the machine and will be able to install.
Check the jdk version existing on your system. If it is not compatible, install the compatable jdk version and try to re-install the application. This should work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.