从官网下的最新的Jenkins,在安装时出现了:
Service 'Jenkins' (Jenkins) failed to start. verify that you have sufficient privileges to start system services
试过网上的各种方法都无效。最后找到了Jenkins的安装目录下有一个jenkins.err.log
,打开后发现里面有一段话如下:
Running with Java 21 from C:\Program Files\Java\jdk-21, which is not yet fully supported.
Run the command again with the --enable-future-java flag to enable preview support for future Java versions.
Supported Java versions are: [11, 17]
See https://jenkins.io/redirect/java-support/ for more information.
意思是Jenkins不支持 Java 21,只支持11和11的版本,而我刚好安装的就是21的版本。里面也提到了可以使用--enable-future-java
参数强行启动。
同样,在安装目录下找到jenkins.xml
,打开后,找到<arguments>
这一行,在其中添加--enable-future-java
参数。保存后重启jenkins服务就好了。
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "D:\Program Files\Jenkins\jenkins.war" --enable-future-java --httpPort=8080 --webroot="%ProgramData%\Jenkins\war"</arguments>
标签:enable,Java,java,Windows,--,future,Jenkins,安装
From: https://www.cnblogs.com/nevercode/p/17830379.html