Getting an error about the main manifest in java

孤街醉人 提交于 2021-02-11 17:49:17

问题


Note, flappyFlyGame is the package that all my class files are in.

I've made a small java project and now I'm trying to export it as a runnable JAR file. However, when I try to run the jar file in the console, I get an error, no main manifest attribute error, even though I've made a manifest file. Inside it, there's one line, Main-Class: flappyFlyGame.Main (the class where the main function is). The classes are all .class files. I've run a command in the console, it should be correct (it was identical to others I found online), jar -cvmf manifest.txt gameFile.jar flappyFlyGame. I've even used Eclipse to generate a jar file, but it says that it can't find the main file. To make sure that it wasn't a project error, I did the same for another insignificant application, with the same results happening. Why doesn't the console recognise or use the manifest file? (I'm not using Maven or anything, by the way.)

Edit: Now answered by dave_thompson_085, I can't mark a comment as an answer though.

来源:https://stackoverflow.com/questions/60403139/getting-an-error-about-the-main-manifest-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!