This content has been marked as final. Show 3 replies
You can't just dump all your .class and whatever files in a .jar file and
expect the jvm to figure out what class to use for the main(...) method.
You have to add a little file, named 'Manifest.mf' in a directory 'meta-inf'
which contains at least this:
Main-Class: YourClassThatContainsAMainMethodI'm about sure that other kind people will supply you with the links to
some tutorials w.r.t. the 'jar' command if you can't find them yourself.
All you need to do is create a text-file (e.g. Manifest.txt) and add the line
to it, AND add a newline at the end of the text-file. Then use the command
provided you have the Manifest.txt file in the current directory and the .class files in a subdirectory named yourpackage (i.e. your class belongs to a package named yourpackage).
jar cmf Manifest.txt JarName.jar yourpackage/*.class