Aside from attributes, you can put a few special values in the manifest file. One of these, Main-Class, allows you to specify the class containing the primary main() method for an application contained in the JAR:
Main-Class: com.oreilly.Game
If you add this to your JAR file manifest (using the m option described earlier), you can
run the application directly from the JAR:
% java -jar spaceblaster.jar
More importantly, under Mac OS X, Windows, and other GUI environments, you can
simply double-click on the JAR file to launch the application. The interpreter looks for
the Main-Class value in the manifest, then loads the designated class as the application’s
startup class.
0 comments:
Post a Comment