Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEVERE: Running with Java class version 53.0, but 52.0 is required error with Jenkins through command prompt as "java -jar jenkins.war"

Tags:

java

jenkins

I am automation engineer i have deployed my build on the Jenkins using maven, I want to when scripts are executed then the browser should open. I searched on it some peoples says my me Run the Jenkins war file through cmd prompt when I am trying to Run the Jenkins through command prompt as:

java -jar Jenkins.war 

Then the system generates an error as follows:

SEVERE: Running with Java class version 53.0, but 52.0 is required error

Anyone have any idea how I can fix the problem?

enter image description here

like image 841
mudassar munir Avatar asked Sep 26 '18 11:09

mudassar munir


People also ask

Which version of Java is required to run the latest version of Jenkins?

Beginning with Jenkins 2.357 (released on June 28, 2022) and the forthcoming 2.361. 1 LTS release, Jenkins requires Java 11 or newer on both the controller JVM (i.e., the JVM running jenkins.

Which version of JDK is required for Jenkins?

OpenJDK JDK / JRE 17 - 64 bits.

How does Jenkins run Java 17?

Open Command prompt and go to the directory where Jenkins is installed. Here, the option --enable-future-java, is used to start Jenkins with Java 17. As you can see, Jenkins is now up and running. Next, you can open your browser and go to http://localhost:8080 or the port number that you provided for Jenkins.


1 Answers

This error message...

SEVERE: Running with Java class version 53.0, but 52.0 is required.

...implies that you have tried to initialize Jenkins on a system which is using java class version 53.0 which stands for Java 9.

As per the Jenkins documentation on Java requirements the following are mentioned:

  • Java 8 is the ONLY supported runtime environment, both 32-bit and 64-bit versions are supported.
  • Older versions of Java are not supported.
  • Java 9 is not supported.
  • Java 10 and Java 11 preview support is available.
  • Support of these versions is available through custom packages
  • Running Jenkins with Java 10 and 11 (experimental support) page provides guidelines about running Jenkins with these versions.
  • These requirements apply to all components of the Jenkins system including Jenkins master, all types of agents, CLI clients, and other components.

Solution

There are two possible solutions as follows:

  • You can downgrade your Jenkins host JRE to Java 8 version and initiate Jenkins as follows:

    ${JAVA8_HOME}/bin/java -jar jenkins.war
    
  • You can upgrade your Jenkins host JRE to Java 10 or Java 11 version and initiate Jenkins along with the --enable-future-java flag as follows:

    ${JAVA10_HOME}/bin/java -jar jenkins.war --enable-future-java
    

Running Jenkins (without Docker)

Java 10

  • Download Jenkins WAR for 2.127 or above (or build the experimental branch)
  • Run the Jenkins WAR file with the following command:

    ${JAVA10_HOME}/bin/java --add-modules java.xml.bind -jar jenkins.war \
        --enable-future-java --httpPort=8080 --prefix=/jenkins
    

Java 11

  • Download Jenkins WAR for 2.127 or above (or build the experimental branch)
  • Download the following libraries to the same directory as jenkins.war
    • jaxb-api-2.3.0.jar (save as jaxb-api.jar)
    • jaxb-core-2.3.0.1.jar (save as jaxb-core.jar)
    • jaxb-impl-2.3.0.1.jar (save as jaxb-impl.jar)
    • javax.activation v.1.2.0 (save as javax.activation.jar)
  • Run the Jenkins WAR file with the following command:

    ${JAVA11_HOME}/bin/java \
        -p jaxb-api.jar:javax.activation.jar --add-modules java.xml.bind,java.activation \
        -cp jaxb-core.jar:jaxb-impl.jar \
        -jar jenkins.war --enable-future-java --httpPort=8080 --prefix=/jenkins
    

trivia

As per Java class file - Wikipedia following are the major version number of the class file format being used:

Java SE 11 = 55
Java SE 10 = 54
Java SE 9 = 53
Java SE 8 = 52
Java SE 7 = 51
Java SE 6.0 = 50
Java SE 5.0 = 49
JDK 1.4 = 48
JDK 1.3 = 47
JDK 1.2 = 46
JDK 1.1 = 45
like image 89
undetected Selenium Avatar answered Oct 24 '22 16:10

undetected Selenium