I'm back... I've had this problem once already when I only had one class in the jar, I went back and added a second class to make it user friendly because I realized that the way I wrote it originally in order for the user to turn off the program they would have to go into task manager and stop javaw.exe process... so I made a second class that has Swing on it and creates a window... and now it is having the problem of not being able to find the main class that is in the manifest again... and I have tried everything that I was directed to do the last time that finally got the other one fixed as well as all the different things that didnt work last time and it keeps giving me the same error...
I tried setting Main-Class to Timer.myTimer and saving the class files to Timer.myTimer.class and Timer.timeClock.class (the package name for the classes is Timer so I thought that maybe having the files saved by just their class names and then it gets into the class and it is in a package might have been the problem... this was not the case)
Maybe this is the problem: Make sure there is an empty line at the end of the MANIFEST.MF file. There's a known problem where Java will not interpret the last line in the manifest if there is no empty line at the end; the tutorial warns about this:
The Java Tutorials wrote:
Warning: The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.
What error message exactly do you get when you enter the following command (please copy & paste the complete error message)?
yes there is a line at the end of the manifest I had that problem the last time.
the error I get is:
Exception in thread "main" java.lang.NoClassDefFoundError: myTimer (wrong name:
at java.lang.ClassLoader.defineClass1(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
Could not find the main class: myTimer. Program will exit.
You put your class inside a package called Timer. That means that a) the class name is Timer.myTimer, and it should be included in the manifest file like this, and b) file myTimer.class should be stored in a folder called Timer inside the JAR file.
lol yep... now I can do my pushups in peace... woohoo... lol but I think I might start my own company off of this thing!! lol I've now started distributing it out to the rest of the office anyone want their own 30 minute timer??? it has a cool little window with a clock with hours minutes and seconds in military time and says "Do your pushups" every 30 minutes on the 00 and the 30 of the hour!
subject: Executable jar Could not find the main class