Creating An Executable Jar File
Creating An Executable Jar File
Skylight Publishing
This line must end with a newline. A jar file created with a main class manifest can be used both as a library and a runnable jar. If you use it as a library, you can edit and compile any of the classes included in the jar, and add it to your project. Then it will override the one in the jar file. You can create a manifest file in any text editor, or even by using the MS-DOS e h command. You can co give your manifest file any name, but its better to use something standard, such as m n f s . x . aiettt Once you have a manifest and all your classes have been compiled, you need to run JDKs j r e e a.x utility. It is located in the JDKs b nfolder, the same place where j v c e eand j v . x . are. i aa.x aaee j r e etakes command-line arguments; if you run it without any arguments, it will display the usage a.x information and examples. You need
Cmwr>jrcf MJraejrmnfs.x *cas \yok a vm yaNm.a aiettt .ls c f means "create a jar; show verbose output; specify the output jar file name; specify the manifest file vm
name." This is followed by the name you wish to give to your jar file, the name of your manifest file, and the list of . l s files that you want included in the jar. * c a smeans all class files in the current cas .ls directory. Below are the detailed steps for doing this in Command Prompt and in JCreator.
www.skylit.com/javamethods/faqs/createjar.html
5/19/12
6. Click OK. Now set up a project for your program, create a manifest file m n f s . x or copy and edit an aiettt existing one. Place m n f s . x in the same folder where the . l s files go. Under aiettt cas V e / o l a scheck the T o stoolbar. Click on the corresponding tool button or press C r - (or iwTobr ol tl1 C r - if this is the n-th tool) to run the C e t J r F l tool. tln rae a ie With Windows Explorer, go to the jar file that you just created and double click on it to run.
www.skylit.com/javamethods/faqs/createjar.html
2/2