Reputation: 9
I made a jar file but when I test it I get a message that the Main class could not be found or loaded.
I have this code:
C:\trafficProject\src>echo Main-Class: Main >manifest.txt
C:\trafficProject\src>jar cvfm trafficProject.jar manifest.txt
added manifest
C:\trafficProject\src>java -jar trafficProject.jar
Error: Could not find or load main class Main
Can anybody help me?
Upvotes: 0
Views: 265
Reputation: 26
the 'c' option means create (a new empty jar file). You need to add classes to the new jar file, i.e. add .class files in the argument list after manifest.txt. Or if you want to just update an existing jar file, use 'u' instead of 'c'.
Upvotes: 0
Reputation: 109547
The MANIFEST.MF should be in a subdirectory META-INF. Case-sensitive, all capitals!
Read the documentation, search in the internet. To overcome starter's problems.
Upvotes: 2