i’m trying to export my Java Project into a runnable JAR file with eclipse but if i want to run the finished JAR file I always get the error
Java Virtual Machine Launcher
Could not find the main class: src.main. Program will exit.
src.main is my main class, if i open the jar with winrar this class is in the folder src in the jar file.
I export the Project like this:
- Right click on the Project name
- Export
- Runnable JAR file -> Next
- Launchconfig: my main class.
- destination: …\Desktop\asdf.jar
- Library handling: Extract required libraries into generated JAR (I also tried all the others)
- Finish
- I get a Warning: “JAR export finished with warnings. ..”
- OK
The libraries are added like this:
- Right click on the Project name
- Properties
- Java Build Path
- Libraries
- Add External JARs
- And than all the libraries are together in one external folder.
What am I doing wrong?
Does src.Start have a proper “public static void main(String[] args)” method?
Are you trying to start the app like this:
“java -jar myjar.jar” or “java -cp myjar.jar src.start”
Also, are you building the manifest by hand, or letting eclipse do it? I don’t remember ever seeing eclipse add a classpath entry in the manifest but I might have missed it.
On the “Jar Manifest Specification” panel during the export, just select “generate the manifest file” and fill in the “Main class:” entry in the input field.