Reputation: 13
I'm trying to build a jar file through the command line, and I'm running into issues.
Here are the contents of my jar file:
META-INF/
META-INF/MANIFEST.MF
bin/main/Main.class
and the contents of my MANIFEST.MF
Manifest-Version: 1.0
Main-Class: bin.main.Main
This seems to me like it should work, but when I try to run the jar file on command line using
java -jar -JAR.jar
I'm told
**Error: Could not find or load main class bin.main.Main**
Upvotes: 0
Views: 81
Reputation: 1356
Make sure your Main.java has package bin.main;
on the first line.
Seelenvirtuose adds that if the package is main, the class file must be put into /main/Main.class
(not /bin/main/Main.class
).
Upvotes: 2