954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Viewing java classes

Is it possible to view the java classes source code or to get it somehow?
I'd really like to see how some of the classes work if its possible

Gink
Light Poster
46 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

Decompile it. I believe you can download some decompilers but I can't recommend any, because I've never done this..

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Hi everyone,

Be very careful about what you do with the decompiled source code as some of them may be copywrited and trying to use these source codes entirely on its own or pass them as your own can really be HUGE trouble for you.

Richard West

freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
 

That and some classes are protected by some device that won't let you decompile...Althought I think there is a way around them.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Nothing will stop decompilation but the usefulness to human readers of the generated code can be made pretty poor :)

And indeed NEVER pass off decompiled code as your own, and NEVER decompile code you didn't get explicit permission for to decompile it.
Such code is copyrighted to someone else and may contain patented information you have no right to.
And if you do get permission to decompile something often you'll get the source as well :)

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

there are also a lot of obuscators which will obuscate your code, aka rename all your variables/methods/classes into completly meaningless terms. for instance

So some variable like studentName might be renamed to a variable called a
and methods will be likewise renamed, so you might see a lot of:

a.fek23();

while this isn't fool proof it will still take a lot of time (and patience) to understand the code

Here are two links to some decompilers, I have never used a decompiler and therefore have no idea if these are any good or not, but please do let me know if they work
http://jode.sourceforge.net/
http://www.devdaily.com/java/edu/pj/pj010021/

paradox814
Posting Whiz
351 posts since Oct 2004
Reputation Points: 13
Solved Threads: 4
 

if you want the source code for Sun's java classes click the link here and just keep going until you find the class you need

http://java.brangle.com/source/

paradox814
Posting Whiz
351 posts since Oct 2004
Reputation Points: 13
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You