Reputation: 1
I've been struggling with this common error and just can't resolve it. This application is composed of multiple packages and runs fine within JCreator (at the moment I need to use this IDE rather than Eclipse).
My manifest file is here (there are 2 blank lines at the end):
Manifest-Version: 1.0
Created-By: 1.6.0_45 (Sun Microsystems Inc.)
Main-Class: C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\main\DPMain
I wrote a bat file to create the jar:
jar -cvfm DPlus.jar C:\COMPILE\MyProjects\douwe\classes\MANIFEST.MF C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\main*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\library*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\command*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\file*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\file\display*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\command*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\file*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\file\display*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\gui*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\gui*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\job*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\job*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\types*.class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\util*.class
When I try to execute with the command
C:\COMPILE\MyProjects\douwe\classes>java -jar DPlus.jar
I always get the error:
Error: Could not find or load main class C:\COMPILE\MyProjects\douwe\classes\dykstra\dplus\main\DPMain
Can anyone see what I'm doing wrong here?
Upvotes: 0
Views: 1428
Reputation: 2389
Usually this error is due to MANIFEST.MF
if the'res no application's entry point has been set.
Your manifest file should have this line of code
Main-Class: YourPackage.DPMain
Alternatively, you can do the following.
java -cp .;app.jar YourPackage.DPMain
Upvotes: 1
Reputation: 3020
In my implementation, there are something different from yours, you can refer:
(1) The folder(before compressed) structure
you need to add a META-INF folder and put your MANIFEST.MF
in it
(2) The content in your MANIFEST.MF
I think your should use the package format instead of a folder tree format:
Manifest-Version: 1.0
Main-Class: com.loadtest.mgr.LoadTestStarter
Upvotes: 0