4

Trying to install Jenkins but it is showing me this error.

Jenkins requires Java versions [8, 11] but you are running 
with Java 16 from C:\Program Files\Java\jdk-16.0.1

Please help!

Anoop Thiruonam
  • 2,567
  • 2
  • 28
  • 48
Ambika
  • 61
  • 1
  • 3
  • 6
  • Seems pretty self-explanatory. Jenkins needs [Java 11 or 8](https://www.jenkins.io/doc/administration/requirements/java/) to run. You have 16. Install 11. And [read the docs](https://www.jenkins.io/doc/book/installing/windows/) – Ian W Sep 05 '21 at 21:06

4 Answers4

8
  1. Download java 11 from below link & install in your system. https://www.oracle.com/in/java/technologies/javase-jdk11-downloads.html
  2. After installing you can find the folder in C:\Program Files\Java\

since I have already installed java 16, I don't want to change the default to 11.

Run Jenkins as mentioned below:

  • open command prompt using run as administrator mode switch to >>> C:\Windows\system32> >> cd C:\Program Files\Jenkins

  • Execute this command C:\Program Files\Jenkins>..\Java\jdk-11.0.12\bin\java -jar jenkins.war --httpPort=8080

  • Jenkin starting after executing above command

  • Go to HTTP://localhost:8080

You can find admin password from C:\Users\myuser\\.jenkins\secrets\initialAdminPassword

Anoop Thiruonam
  • 2,567
  • 2
  • 28
  • 48
  • Hi, your solution worked perfectly! but the thing is, I need to run those commands every single time to start Jenkins. Is there a way I could permanently change the preferred JDK? – Srinil Khandwala Jan 14 '22 at 13:17
  • Yes, you can change the system environment variable "JAVA_HOME" path to your preferred java SDK version path – Bala Subramanian Apr 18 '22 at 11:20
2

In my case, I was not able to fix it with the above solutions. So, what worked for me is, in environment variables, you can update the path of JAVA_HOME as C:\Program Files\Java\jdk1.8.0_321 or the specific path in which you have your java installed. The advantage here is you need not delete the other versions of java. Also remember you need to delete C:\Program Files\Common Files\Oracle\Java\javapath C:\Program Files (x86)\Common Files\Oracle\Java\javapath from the existing system variables so that it will consider version 8 as default. path for JAVA_HOME ensure to remove pre-existing javapath from here

Also need to update the java version pointing in the jenkins to jdk1.8.0_321 in the C:\Program Files\Jenkins\jenkins.xml file

<executable>C:\Program Files\Java\jdk1.8.0_321\bin\java.exe</executable>
vinny
  • 360
  • 3
  • 10
0

Create 2 batch files using solution provided by

Bala Subramanium

so u can start Jenkins with one/two click/s

First Bat File is Jenkins_Initiate.bat ------>>>>> (use to start Jenkins)

cd C:\Program Files\Jenkins

..\Java\jdk-11.0.13\bin\java -jar jenkins.war --httpPort=8080

make sure to have 2 spaces between java & -jar

Second Bat File is Jenkins_Launch.bat ------>>>>> (use to lauch Jenkins on chrome)

start chrome http://localhost:8080

0

You can use the option —enable-future-java. You can run jenkins.war on command prompt with the above option. Or you can edit xml file jenkins within your installed Jenkins package to add this option. The following blog discusses this solution. https://medium.com/@rakhi.mundhada1/how-to-run-jenkins-with-java-17-on-a-windows-machine-2a1b1c50960a Same can be applied to Java 16.

Guest
  • 11
  • 1