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 find source code through Jar file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "find source code through Jar file." Watch "find source code through Jar file." New topic

find source code through Jar file.

Ajoy Sharma

Joined: Feb 24, 2004
Posts: 18
I am a beginner java programmer and have been entrusted with learning our company's Java application. The architect of the application is not forthcoming in sharing information and so I need help in tracing the source code for the application. I know where the .jar files are stored but I don't know where the actual .java or .class files are stored.

In the .profile file, I see the classpaths set to various jar files. eg.


When I view this jar file with command "jar tf eaiRun.jar", it displays all the files under it. Onc such listing is as following:


I want to go to that specific directory on our file system which is storing these .class file. From what I have learned about packages, I should find some folder called 'citi' ,'eai'.
However I am not able to find these folders anywhere on file system. Is there a way I can find where the actual souce code is by looking at the jar files.

Please help. Let me know if you need more information.
sunitha reghu
Ranch Hand

Joined: Dec 12, 2002
Posts: 937
If you have eclipse open those class files in eclipse , you will see the source code. Even jbuilder also do that. Otherwise use Mocha. I do have that. Do a search in google if not i can send that.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

You can also check the DJ Java Decompiler from here

Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
A jar file is like a zip file. Just because some class is in a jar file on the system does not mean that the source file is on the system.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Ajoy Sharma

Joined: Feb 24, 2004
Posts: 18
Thanks everybody for your help. I will download these tools and go from there.
Also, I would ask the architect what development procedure he follows if he does not store the source code files on a UNIX system from where the actual application runs.

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Eclipse doesn't show source for class files without adding a plugin does it? We use the Jadclipse plugin found here:

Keep digging for source access. If you have a lot of jars and a lot of class files you might write a little program to open a jar file, read the directory and write a report with package name, class name and jar name. Let the uncooperative architect see you using the report, but don't give him one. Heh heh heh.
[ July 02, 2004: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: find source code through Jar file.
jQuery in Action, 3rd edition