我通过运行应用程序:java -jar app.jar。它的工作很好!但是设置像服务一样通过https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html运行。时sudo service ccth start,则发生以下错误:/etc/init.d/ccth: line 1: $'PK\003\004': command not found/etc/init.d/ccth: line 2:Dr�Lorg/PK: No such file or directory/etc/init.d/ccth: line 3:Dr�Lorg/springframework/PK: No such file or directory/etc/init.d/ccth: line 4:Dr�Lorg/springframework/boot/PK: No such file or directory/etc/init.d/ccth: line 5: $'\bDr\376L': command not found/etc/init.d/ccth: line 6:Dr�L%org/springframework/boot/loader/data/PK: No such file or directory/etc/init.d/ccth: line 7:Dr�L/springframework/boot/loader/jar/PK: No such file or directory/etc/init.d/ccth: line 8: syntax error near unexpected token `$'org/springframework/boot/loader/archive/PK\003\004''/etc/init.d/ccth: line 8: Dr�L(org/springframework/boot/loader/archive/PK'我该如何修复它们?
2 回答
沧海一幻觉
TA贡献1824条经验 获得超5个赞
感谢您发布问题。我花了一些时间研究完全相同的问题。我使用 gradle 来构建 jar,我需要包括:
bootJar { launchScript()}
然后只需确保您运行新创建的文件。
慕哥9229398
TA贡献1877条经验 获得超6个赞
您很可能<executable>在构建配置中缺少该选项。没有它,您将生成一个常规 JAR,而不是可执行的 JAR。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
添加回答
举报
0/150
提交
取消