"Could not find the main class" error when executing a self-made Jar
Hi,
I'm new to jar creation, and just attempted to package my class files together with libraries using Ant.
I've managed to get the JAR file with MANIFEST.MF inside. The MANIFEST.MF is as below:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_08-b03 (Sun Microsystems Inc.)
Main-Class: mg.misc.GameGui
Class-Path: jchart2d-2.1.0.jar jcommon-1.0.8.jar jfreechart-1.0.4.jar swing-worker-1.1.jar
Inside the actual JAR file, I have a package called mg, and within mg, I have many sub-packages, and one of them is called misc, and the main class I want to run is in there. Moreever, all those libraries are outside mg
Can anyone spot any possible cause of the error? Many thanks.
[760 byte] By [
cyaevana] at [2007-11-26 21:10:00]

sorry, the .class is not needed.
are you sure your GameGUI contains an entry main method ?
If so, try this instead
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_08-b03 (Sun Microsystems Inc.)
Class-Path: jchart2d-2.1.0.jar jcommon-1.0.8.jar jfreechart-1.0.4.jar swing-worker-1.1.jar
Main-Class: mg.misc.GameGui
hth
Trying to guess the cause is a losing proposition. Post some small, self-contained, compilable, and executable code that illustrates the problem. Define the disk/directory structure of the involved classes, so that the code can be compared with the class locations. Eliminate anything that isn't needed to illustrate the problem from the post.
Alternatively, follow a good tutorial, starting with everything in one directory, verifying that it works, and then add complexity, verifying that everything still works after each incremental change.