I’ve just made a game in netbeans. The Problem is that after builting the game. I’m not able to execute the jar file and getting the exception:
Failed to load Main-Class manifest attribute from
Game.jar
What to do???
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For a JAR to be self-executable, you have to include the
Main-Classline in a manifest.I’m not a NetBeans user, but this is how it’s done.
Create a
manifest.mffile:Build the jar:
jar cmf manifest.mf Game.jar path/to/classes/*.classYou should now be able to to double-click on the JAR to run it (assuming Windows), or you can run it via the command line:
java -jar Game.jarOf course, you can always run from the command line without the need for a manifest:
java -cp .;Game.jar YourGame