File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes can we decompile and get the orginal source code,is it possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can we decompile and get the orginal source code,is it possible?" Watch "can we decompile and get the orginal source code,is it possible?" New topic
Author

can we decompile and get the orginal source code,is it possible?

Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1055

is it possibe to decompile the class file and get the source code???if yes how come java becomes security concious?


http://www.lifesbizzare.blogspot.com || OCJP:81%
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

You can't get the source code as is, because all comments are removed, and generic information is also gone. Most of it is still available. You can make it harder by using obfuscators but all those do is make it hard to read the decompiled code, not impossible.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18750
    
  40

Decompiling an executable, is *always* an option -- regardless of the program. The JVM needs to open and read class files, so hence, the class files can be opened by a decompiler. This is also true for other languages. Something has to be able to read and run the program, hence, another thing should be able to read and decompile it.

There is no way to stop decompilation. The only thing that can be done is to make it harder. In the case of Java, there are ofuscators that does weird things to the class files, so that they will still run, but will look weird when they are decompiled. But even then, a good programmer can easily get the jist of the decompiled code.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can we decompile and get the orginal source code,is it possible?