I'm trying to start Jenkins using:
java -jar jenkins.war
I got this error:
java.lang.UnsupportedClassVersionError: 54.0
at Main.main(Main.java:128)
This problem comes after an update of my development environment, I'd switched to :
- Java 10.0.1+10
- Jenkins 2.107.2
- MacOS 10.13.4
Based on the error message that you are getting:
- The JAR / WAR file being loaded was compiled for Java 10 (and later) because the message says that the classfile version is 54.
- The JRE that is actually being used is Java 9 or earlier. If you were using Java 10, it would be happy with version 54.
In other words, despite upgrading your Java to Java 10, you must be using an older version to start Jenkins.
Check the launch script for Jenkins and make sure that it uses the correct JRE installation.
If you are launching Jenkins using java -jar jenkins.war
, check what java -version
tells you ... at the same command prompt.
An easier approach could be to download Jenkins WAR for 2.127 (weekly release) or above. Then one can run the war with the following command:
${JAVA10_HOME}/bin/java --add-modules java.xml.bind -jar jenkins.war \
--enable-future-java --httpPort=8080 --prefix=/jenkins
Though note that there are few known issues registered on their tracker :
- Pipeline crashes immediately on Java 10 and 11 (JENKINS-46602)
- There are many warnings about Illegal reflective access during execution (JENKINS-40689)
- Configuration-as-Code plugin fails to export configurations on Java 10 (JENKINS-51991)
Here are the individual tracker for Java 10 compatiblity and one for Java 11.
Source - Jenkins with Java10-11