Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins JRE Update

I am running a Jenkins server on Windows that is using the JRE in the Jenkins folder. The version is 1.8.0_66 but the Let's Encrypt certificate used by the Update Center is not compatible with this version, hence I need to update it.

Is there a stand-alone JRE available that I can replace the contents of this folder with, or is there a standard way of updating this JRE within Jenkins itself?

like image 591
Dan Def Avatar asked Mar 23 '18 20:03

Dan Def


2 Answers

You can install Java on your local computer from here. Typically on Windows it would install it in a folder like C:\Program Files\Java\jdk1.8.0_161. Then just copy the JRE folder C:\Program Files\Java\jdk1.8.0_161\jre along with all its subfolders and files from your local computer to the JRE in the Jenkins folder (JAVA_HOME) so that you replace its contents. You can see JAVA_HOME from Jenkins System info. You can archive your old JRE installation files before that.

The second option is to install JRE on your Jenkins server directly from here. It will create a directory like this C:\Program Files\Java\jre1.8.0_161. Then you could copy this folder contents into the Jenkins_home/jre folder or the folder your Jenkins is using.

Third option is to install JRE on your Jenkins server and then change the JAVA_HOME variable so that Jenkins uses the standard folder for your operating system. More info here.

You may need to import your certificates into java keystore. See How to import a .cer certificate into a java keystore?

like image 123
K. B. Avatar answered Oct 09 '22 03:10

K. B.


This is for windows users who happen to stumple upon this question (like I did). You need to have the system environment variable JAVA_HOME set.

  1. stop jenkins service
  2. edit in the jenkins base folder edit jenkins.xml -
<env name="JENKINS_HOME" value="%BASE%"/>
   <!--
     if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
     The following value assumes that you have java in your PATH.
   -->
   <executable>%BASE%\jre\bin\java</executable>
   <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

change %BASE% to %JAVA_HOME% in "executable"

<env name="JENKINS_HOME" value="%BASE%"/>
   <!--
     if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
     The following value assumes that you have java in your PATH.
   -->
   <executable>%JAVA_HOME%\jre\bin\java</executable>
   <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
  1. start jenkins
like image 4
Barry MSIH Avatar answered Oct 09 '22 03:10

Barry MSIH