"Could not find the main class" when running a jar
Hi, I'm trying to create and run a jar from my application, but I can't figure out how to properly set an entry-point. Looking at the Java Tutorials http://java.sun.com/docs/books/tutorial/deployment/jar/index.html I still can't get it to work.
I have a directory myApp, which contains a directory images and some class files, including mainClass.class. I also have a manifest Manifest.txt in the directory myApp with the following line:
Main-Class: mainClass.class
+ one empty line
I create a jar successfully, while inside the myApp directory, with the following command:
jar cfm myApp.jar Manifest.txt *.class images\*.*
I then proceed to run the jar with the following command:
java -jar myApp.jar
and receive the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: myApp/class
My completely uneducated guess is that there is something wrong with my manifest. The tutorial says that the line should be:
Main-Class: MyPackage.MyClass
I'm assuming that I get the error because I didn't specify a package, which I didn't do because I didn't know what to put there. Do I even have a package?
Can anyone tell me what I've done wrong? thanks.
Message was edited by:
SmurfZG

