Reputation: 660
I have a jar file , which when i execute by
java -jar firstjar.jar
I get the following errors
Error: Invalid or corrupt jarfile firstjar.jar
Here is my manifest file
Manifest-Version: 1.0
Created-By: 1.7.0_79 (Oracle Corporation)
Class-Path:mysql-connector-java-5.1.28.jar
Main-Class:JavaApplication1
Contents of jar file
0 Wed May 13 14:09:06 IST 2015 META-INF/
140 Thu May 14 00:26:26 IST 2015 META-INF/MANIFEST.MF
2917 Wed May 13 13:16:02 IST 2015 JavaApplication1.class
Thanks in advance!
Upvotes: 0
Views: 1412
Reputation: 61
Perhaps your jarfile is corrupted in some way, possibly due to how it was downloaded or installed.
this issue is caused by manifest file because you haven't added space after every colon in here, it should be:
Manifest-Version: 1.0
Created-By: 1.7.0_79 (Oracle Corporation)
Class-Path: mysql-connector-java-5.1.28.jar
Main-Class: JavaApplication1
after Main-Class there must be a Blank line see here https://docs.oracle.com/javase/tutorial/deployment/jar/modman.html.
Upvotes: 2