Experienced Java/Java EE Engineer (Architect and developer) , team leader and agile enthusiast. Most of the projects where the employee has been involved in the last 10 years were based on J2EE architectures. He has been working as a team leader and project manager for the last 8 years. He was technical leader and member of the development team for major projects in public sector such as National Municipal Registry, Online. Patroklos is a DZone MVB and is not an employee of DZone and has posted 18 posts at DZone. You can read more from them at their website. View Full User Profile

Make Jenkins Windows Service use your Preferred JRE

11.26.2013
| 5866 views |
  • submit to reddit

Recently I was working on installing and configuring a new instance of Jenkins. For some reason, which is out of this post’s context, I wanted to make Jenkins run with a specific version of the Java environment. Fortunately it was something really easy. This post is mainly a reminder to me, next time I’d like to do the same :)

Jenkins by default uses the jre which located under the jre sub-directory of your jenkins installation home ( %JENKINS_HOME ).

To change this find the file named jenkins.xml in which is located in your %JENKINS_HOME directory. 

Edit it and look for the following section

 <executable>%BASE%\jre\bin\java</executable>

Now change the content of the executable property to point to your favorite JRE. You can describe it as an absolute or relative path or you can even use, environment variables.

Save the file and restart Jenkins.

That’s it!

Enjoy!

Published at DZone with permission of Patroklos Papapetrou, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)