方法一
在Jenkins目录下,运行一下命令:
java -jar jenkins.war --ajp13Port=-1 --httpPort=8081
出现了错误:
C:Program Files (x86)Jenkins>java -jar jenkins.war --ajp13Port=-1 --httpPort=8081
10╘┬ 28, 2019 5:20:17 ╧┬╬τ Main verifyJavaVersion
╤╧╓╪: Running with Java class version 57 which is not in the list of supported versions: [52, 55]. Run with the --enable-future-java flag to enable such behavior. See https://jenkins.io/redirect/java-support/
java.lang.UnsupportedClassVersionError: 57.0
at Main.verifyJavaVersion(Main.java:174)
at Main.main(Main.java:142)
Jenkins requires Java versions [8, 11] but you are running with Java 13 from C:Program FilesJavajdk-13.0.1
java.lang.UnsupportedClassVersionError: 57.0
at Main.verifyJavaVersion(Main.java:174)
at Main.main(Main.java:142)
这里的57,52,,55 是什么意思呢?
java的主版本号对应关系是:
Java SE 14 = 58
Java SE 13 = 57
Java SE 12 = 56
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
而支持jenkis启动的版本只有JDK8
和JDK11
,当前环境是JDK13
并不支持。所以不能用这个方法。
方法二
在Jenkins根目录下找到jenkins.xml
文件:
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%jenkins.war" --httpPort=8080 --webroot="%BASE%war"</arguments>
修改以后需要重启Jenkins服务才能生效。