File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes How to get .java file from .class file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to get .java file from .class file?" Watch "How to get .java file from .class file?" New topic

How to get .java file from .class file?

Pawan Rao
Ranch Hand

Joined: Dec 29, 2005
Posts: 30
To get .class file from .java, we have javac.
But, how do we get .java file if we have only the .class file?

Stop not till the goal is reached...
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

[My Blog]
All roads lead to JavaRanch
Tauri Valor
Ranch Hand

Joined: Aug 03, 2005
Posts: 180
You can use Java Decompiler tools for this. One such tool is jad.
Search Google for jad.

A Moment's insight is sometimes worth a Life's experience.
Pawan Rao
Ranch Hand

Joined: Dec 29, 2005
Posts: 30
Thanks a lot.
Gadi Reddy

Joined: Jan 10, 2006
Posts: 21
By using Java Decompiler we will get .java file .
but the thing is we are not getting exact java file( but we will get whatever we write the java file apart from that we will get some system generated code also , but no problem.
Ashan Ranasinghe

Joined: Oct 06, 2004
Posts: 8
you could also use jcavaj

thats a cool tool.

also the jdk comes with its own tool but thats not so good

subject: How to get .java file from .class file?
It's not a secret anymore!