Skip to main content

how to extract jar files????

8 replies [Last post]
Joined: 2006-08-01

Hi, I'm trying to extract a jar file without luck...any ideas??? pls :(
More specific i have write at the path ...C:\...\...\tools.jar
but at command line there is chaos...
when i write jar xf jarfilename.jar i take the message
C:\Program Files\Java\jdk1.5.0_02\lib>jar xf wizard.jar
'jar' is not recognized...etc.

What i have to do...


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-08-01

Thank you all for your help.The truth is that after i send the sms i did it with the way that here_he_is_javanet suggested.And jwenting i am not crosspost :)

Thanks again!!!

Joined: 2010-02-25


Some people here have mentioned that you can use Winzip and other such programs to extract JAR files. While that is true, such programs will not help you if you need to modify and reuse the JAR. You have to use the JAR utility you get with any JDK to manipulate JARs. This post has some details:


Joined: 2008-01-03

> when i write jar xf jarfilename.jar i take the
> message
> [i]C:\Program Files\Java\jdk1.5.0_02\lib>jar xf
> wizard.jar
> 'jar' is not recognized...etc.[/i]

the location of the jar.exe file is in the bin directory, not the lib.
Also you have to check that you have the jar.exe file, because in the 1.4.2 version not all the releases have it. For example 1.4.2_13 (or previous) doesn't have it, but 1.4.2_16 has the jar.exe

So even if you don't have the classpath set up, if you go to the java\bin directory and you have there the jar.exe file it should work just fine with your command above

Joined: 2005-11-20

This is cheating, but you can use WinRar to extract .JAR files.

Just open the file with WinRar and you should be able to extract it the same way as you would a normal compressed archive.

It works just as well for those ISO files as well.

Joined: 2007-09-22

Thank you, thank you very much.
I am just a translator and the developper wanted that I undestand of JDK just to extract the files that I have to localize.
Thank you for your tip.

Joined: 2005-02-10

Jar files are zip files. Rename the file extension to zip and and do a right mouse click in windows file explorer to extract it. Or use jar.exe. You have set the PATH environment variable correctly, of corse.

Well, I am not quite sure that I understand your question. If you are looking for a way to dezip programmatically, then have a look at java.util.jar.JarFile.

Hope that helps.

Joined: 2003-12-02

no, he has NOT set his path correctly.
Why he wants to unpack the standard libraries is well beyond me though...

Joined: 2004-03-04

Symptoms of not setting the path properly:

Go to the command line.

Type in "jar" (in any directory)

If the path to the jdk is not set you will see something like this:

C:\Documents and Settings\rickc>jar
'jar' is not recognized as an internal or external command,
operable program or batch file.

If the path is set correctly, you will instead see something like this:

Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] fil
es ...
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified manifest file
-e specify application entry point for stand-alone application
bundled into an executable jar file
-0 store only; use no ZIP compression
-M do not create a manifest file for the entries
-i generate index information for the specified jar files
-C change to the specified directory and include the following file
If any file is a directory then it is processed recursively.
The manifest file name, the archive file name and the entry point name are


To set the path under windows xp:

right click on My Computer
advanced tab
environment variables

create a Path user variable with the location of the bin directory of your jdk, e.g. C:\jdk6\bin

Save settings and create a new dos window

You should also then be able to type in commands like
java -version

And get version or usage information as appropriate.

Setting up multiple JDKs in a single environment and swapping between them on the fly is left as an exercise for the reader :D