Failed to start Jenkins on macOs - Java 10

孤街浪徒 提交于 2019-12-18 16:48:17

问题


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

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/50200406/failed-to-start-jenkins-on-macos-java-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!