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

Viewed 11624

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!

4 Answers
  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

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>

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

Related