no main manifest attribute, in /hello.jar
时间: 2023-11-07 18:17:11 浏览: 110
当执行java -jar命令时,如果出现"no main manifest attribute"的错误提示,意味着在指定的jar包中没有找到主清单属性(main manifest attribute)。
通常情况下,当使用java命令运行一个jar包时,需要在jar包的MANIFEST.MF文件中指定Main-Class项来标识主类。这个主类会作为程序的入口点来执行。如果没有在打包成jar包时指定这个主类,就会出现"no main manifest attribute"的错误提示。
解决这个问题的方法是,在打包jar包时,要确保在MANIFEST.MF文件中正确地指定了Main-Class项,以便能够找到对应的主类。这样在执行java -jar命令时,就能够正确地找到程序的入口点,并成功运行jar包。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Linux系统下运行jar文件,提示:No main manifest attribute, in XXX.jar](https://blog.csdn.net/weixin_39993301/article/details/116913753)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文