File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Extracting .java files from .class files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Extracting .java files from .class files " Watch "Extracting .java files from .class files " New topic

Extracting .java files from .class files

Meghna Prasad

Joined: Jan 22, 2002
Posts: 11
If I have a jar file x.jar which has y & z classes, how do I extract file from x.jar file ? What is the procedure for this ?

Joe Gilvary
Ranch Hand

Joined: May 11, 2001
Posts: 152
Get the class files out of the jar
jar xf x.jar y.class
jar xf x.jar z.class
Disassemble the class files. If you do not
have a particualar product, use javap from
the JDK.
If you hope to see the code for some class
that you bought, you may find that it has been
obfuscated, i.e. method and variable names changed
to make the disassembled code very confusing.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

This doesn't really belong in the Swing/JFC/AWT forum ( even if you're trying to decompile code that uses these classes... ) So I'm moving it to Java In General (Intermediate).


P.S. - Check out DJ Java Decompiler. It uses JAD, is put together well, and has an easy to understand GUI...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: Extracting .java files from .class files
jQuery in Action, 3rd edition