Distribute a java program to others
Posted on July 7, 2008
Filed Under Java |
How to distribute a java program to others?
Using a text editor, create a file (say, myManifest) containing the following lines:
Manifest-Version: 1.0
Main-Class: MyMainClass
where MyMainClass is the name of the class containing the main method you want to use.
From the command line, execute the command:
jar cvfm myResult.jar myManifest *.java *.class
where myResult.jar is the jar file you are trying to create, myManifest is the file you created in step 2, and everything else is the files you want to include.
On Microsoft Windows systems, the Java 2 Runtime Environment’s installation program will register a default association for Jar files so that double-clicking a Jar file on the desktop will automatically run it with javaw -jar. Dependent extensions bundled with the application will also be loaded automatically. This feature makes the end-user runtime environment easier to use on Microsoft Windows systems.
Tags: Java
If you enjoyed this post, make sure you subscribe to my RSS feed!
Comments
Leave a Reply