Question
How do I create a .JAR file?
Answer
Java Archive (JAR) files allow developers to package many classes into a single file. JAR files also use compression, so this can make applets and applications smaller.Creating a .JAR file is easy. Simple go to the directory your classes are stored in and type :-
jar -cf myfile.jar *.classIf your application or applet uses packages, then you'll need to do things a little differently. Suppose your classes were in the package mycode.games.CoolGame - you'd change to the directory above mycode and type the following :- (Remember to use / on UNIX systems)
jar -cf myfile.jar .\mycode\games\CoolGame\*.classNow, if you have an existing JAR file, and want to extract it, you'd type the following
jar -xf myfile.jarWorking with JAR files isn't that difficult, especially if you've used the unix 'tar' command before. If you're planning on packaging an applet for Internet Explorer, or an application for Microsoft's jview, you might also want to consider .CAB files.
Tool for Creating JAR (Very useful when your Jar is Huuuuge !!)
A JAR file aggregates many files into one and is used by Software developers to distribute Java classes and associated metadata through .jar files. Are you looking for a quick way to create executable JAR files? Small utility Java JarWizard makes .jar file creation process real easy.
It has neat wizard based interface to include required files. Just select and include files you want in the final .jar archive file and click next button. In the end, it creates executable .jar file that can be easily run by any user. Download Java JarWizard
If you want to replace class files in the Jar files, the best tool to do that is Winrar, you can download it from here
Open the Jar file and just paste the desired class using Ctrl + v.
And just close winrar. It works like magic.
I didnt know this Winrar trick and i wasted nearly 3hours, where in my app server was throwing all kinds of exceptions when i manually replace class files using WinZip and CMD
TIPS: WinRAR , JAR , Extract JAR using Command prompt, Extract JAR using WinRAR, Extract JAR using Jar tool, Easy way to extract JAR, Simple way to extract JAR, Easy way to create JAR, Simple way to create JAR,
Please check with Manuals. Author is NOT responsible for any misinformation / incorrect information or typographical errors.
NOTE: If you would like to share any useful info, please mail to the authors.
No comments:
Post a Comment
Happy Reading!