Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to view source code from .jar file using RAD 6 ?

Posted on 2007-10-03
11
Medium Priority
?
12,032 Views
Last Modified: 2013-12-22
Hi,

I have a jar file and I want to be able to view the souce code using RAD 6.
How can I do that?

I know that I need a decompiler to view the source from a jar file, right?

Doesn't RAD have any decompiler integraded with it?

If not what should I do to view the source from a jar file?


Thax.
_Esam.
0
Comment
Question by:_Esam
10 Comments
 
LVL 12

Accepted Solution

by:
Gibu George earned 336 total points
ID: 20011868
Hello _Esam,

You need to extract the class files from the .jar file using jar -xvf <jarfilename>, and need to decompile each of the class files to see the code, you can use DJ Java Decompiler to decompile the class files. I am not sure whether RAD 6 has any decompiler coming with it

Regards,

gibu_george
0
 

Author Comment

by:_Esam
ID: 20014281
I know I can unjar the jar file using jar -xvf jarfilename.jar but I needed to know how can I set up RAD with a decompiler plug in if RAD doesn't have it already ???
How can I attach a plug-in for decompiler for RAD (it's just eclipse at core ?)..

Thax.
_Esam...
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 20016339
First, to integrate the JAD decompiler, you can follow the instructions here: http://www.devx.com/Java/Article/22657

However, you may not have to do this. RAD already has source for many of the jars it ships with, so if you include the JAR in your build path, it'll appear in your project, and you can expand the jar , doublie-click on the class name and it'll pop up as source in teh Java editor. You can also explicitly associate source with a jar, and it'll react similarly.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:_Esam
ID: 20017206
I tried the above link already and it does't work ... the way it was suggested..because...
For Eclipse\plugins  ... I have multiple Eclipse\plugins  folders .. where do I really place it?


The second ...
Double clicking the .class from the explorer doesn't open the source...
It complains... Source not found !!!

That's why I needed the JAD decompiler ..

Thax.
_Esam.
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 20017745
I'm using RAD 7, so I have a different directory structure to you. However, I'm pretty sure there's an eclipse\plugins directory under the installation directory. If you go to the JADClipse wiki at http://jadclipse.sourceforge.net/wiki/index.php/Main_Page, it'll give you some more instructions.
0
 

Author Comment

by:_Esam
ID: 20017872
How do I do:

eclipse -clean

if I am using Win XP?

Thax.
_Esam.
0
 

Author Comment

by:_Esam
ID: 20017881
RAD is pain...
I did use JAD with simple eclipse earlier and it worked fine...
0
 
LVL 1

Assisted Solution

by:hemsakb
hemsakb earned 332 total points
ID: 20019601
To browse the source of a type contained in library you can attach a source archive or source folder to this library. The editor will then show the source instead of a the decompiled code. Having the source attachment set the debugger can offer source level stepping in this type.

The Source Attachment dialog can be reached in several ways:

Select a JAR in the Package Explorer and choose Properties > Java Source Attachment from the context menu or the Project menu
Open the Java Build Path page of a project (Projects > Properties > Java Build Path). On the Libraries page expand the library's node and select the Source attachment attribute and press Edit
Open an editor on a class file. If the source attachment has not already been configured for this JAR, the editor contains a button Attach Source
Depending of how a JAR was contributed to the classpath, you can see different types of Source attachment dialogs:
0
 
LVL 15

Assisted Solution

by:bpmurray
bpmurray earned 332 total points
ID: 20020404
You shouldn'e have to do eclipse -clean. However, if you go to your installation directory, in a DOS box, and ype "eclipse -clean" and then exit, it'll have reset the cache.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20439044
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Loops Section Overview
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question