Possible Duplicate:
Corrupt jar file
I made a game in Eclipse and packaged all the class files in test.jar. When I attempt to run it, it gives me the error:
Error: invalid or corrupted jar file.
I opened the .jar file using Winrar, and everything is in there.
I have looked for a similar question on Stack OverFlow, but didn’t find any. Can you explain to me how I can solve this error?
FOR EVERYONE WITH THIS PROBLEM ,SOLUTION:
Go to file, export, export as a Runnable Jar, Select your main class, finish.
If you want to run your program in cmd, create a new textfile, and type java -jar project.jar with project = name of your program.
Save this as Run.bat
then open the Run.bat, it will automatically open project.jar
Thats it, it worked for me!
How you place your classes to tar.jar? A valid jar file must follow some rules it requires. You’d best generate them by your Eclipse tools. click “export” -> “jar” and select the right entry of your game. Good Luck.