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

Solution 1:

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

Solution 2:

java -jar jenkins.war --enable-future-java

Solution 3:

Jenkins is supported java version are 8,11 . jenkins not supported older versions and java 9,10,12 and 13 too , you have to downgrade java version to 8 or 11

Solution 4:

I have installed Java 15 on my system. To run Jenkins with Java 15, please execute the below command.

D:\Selenium\Jenkins>java -jar jenkins.war -httpPort=9090 --enable-future-java

Change path to your war file.