Home Java Javatutorial How to Unjar a Jar file in Java

Related Tutorials


 
 

Share on Google+Share on Google+

How to Unjar a Jar file in Java

Advertisement
Following are the steps to Unjar a JAR file in Java. A JAR files archives all the classes and other things at one place making it easy and portable for programmer to run a program.

A JAR file is a collection of Java class files that contains images, methods, texts, etc into one file. All these class files are compressed and archived to one place to make the file portable. This file can be used by anyone anywhere.

JAR file in Java simplifies distribution and makes it available across multiple operating systems. Users can unjar a JAR files using the jar command that comes with a JDK.

Following are the steps to Unjar a Jar file in Java for Windows:

  1. A Java SDK Java Platform Standard Edition Development Kit must be installed in your system.
  2. Then we have to find "jar.exe" file that needs to be unjar inside this Java SDK folder. By default, jar.exe file is inside the bin folder.
  3. Click Start and then Run, type cmd and click OK.
  4. To go to this bin folder, copy the path and paste it in the command prompt. Example: cd C:\Program Files\Java\jdk1.6.0_05\bin. cd specifies change directory, to go inside a drive and to a particular folder.
  5. To execute the jar.exe utility use xf parameter. x and f indicates the you're extraction files from the archive. Example: jar xf Demo.jar will extract all of the folders and files compressed inside Demo.jar file and place all of them into the current folder.

Points to remember while extracting a jar file:

Use "-C" parameter to extract the JAR files to a different location. Example: jar xf Demo.jar -C "C:\Documents and Settings\June2013\Java".

Following these steps will help you to unjar or extract a jar file to a specified folder. In the same way a user can create a JAR file. JAR files are more convenient as all files are compressed and stored at one place and you just have to execute a single command line to unjar those files. It is better and less hectic than downloading all those uncompressed files separately.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 21, 2013

Related Tutorials

Discuss: How to Unjar a Jar file in Java  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com