test | no main manifest attribute, in hello.jar
时间: 2023-08-26 13:07:09 浏览: 207
问题: test | no main manifest attribute, in hello.jar是什么意思?如何解决这个问题?
回答: 这个错误信息表示在hello.jar中没有指定主清单属性(main manifest attribute),导致无法找到可执行的主类。通常在使用java -jar命令运行jar包时会出现这个问题。为了解决这个问题,你需要在打包成jar包时指定主类。在MANIFEST.MF文件中添加Main-Class项,指定你的项目的启动类的包路径。这样在运行java -jar命令时就能找到对应的主类了。\[1\]另外,如果你使用的是Maven进行构建,你还需要在pom.xml文件中引入spring-boot-maven-plugin插件,以确保正确生成可执行的jar包。\[2\]\[3\]
#### 引用[.reference_title]
- *1* [Linux系统下运行jar文件,提示:No main manifest attribute, in XXX.jar](https://blog.csdn.net/kangkangwanwan/article/details/78592546)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [jar运行报错no main manifest attribute](https://blog.csdn.net/qq_33697094/article/details/110549536)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [no main manifest attribute, in XXX1.0.0-SNAPSHOT.jar](https://blog.csdn.net/weixin_44403003/article/details/118097084)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文