The Artima Developer Community
Sponsored Link

Java Answers Forum
Converting .class files to .java files

6 replies on 1 page. Most recent reply: Jun 2, 2006 4:18 PM by david alves

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
Ray Hopkin

Posts: 3
Nickname: rayhopkin
Registered: May, 2006

Converting .class files to .java files Posted: May 26, 2006 4:11 PM
Reply to this message Reply
Advertisement
Hi everyone:


Is there a way to convert my compiled .class files back to .java files?


Thanks.


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Converting .class files to .java files Posted: May 29, 2006 12:16 AM
Reply to this message Reply
There are several decompilers around.
Try looking for DJ Decompiler

The variable names will be messed up of course, but the structure of the program will be more or less equal to the original source code.

Ray Hopkin

Posts: 3
Nickname: rayhopkin
Registered: May, 2006

Re: Converting .class files to .java files Posted: May 29, 2006 11:36 AM
Reply to this message Reply
Thanks Matthias. So does this mean that there is no way to protect java programs from having their source files exposed to anyone who has a decompiler? What is the best way to protect software written in java?

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Converting .class files to .java files Posted: May 29, 2006 11:03 PM
Reply to this message Reply
The key word is 'obfuscating'.

There are obfuscators which during or after compiling (I don't know, didn't try it yet) rename all of your method names and variables. Also, they insert sensless code which does not influcence the execution of the program, but makes it very difficult to read the code.
If you use hard coded Strings, don't write them directly in the source code, but create them through methods or something.

I don't know how much it helps, but there are also some tools which create a .exe file for your program. Most tools support integrating the JAR file into the .exe file, so if someone wants to decompile it, he has first to disasemble the .exe file.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Converting .class files to .java files Posted: May 30, 2006 6:30 AM
Reply to this message Reply
> Thanks Matthias. So does this mean that there is no way to
> protect java programs from having their source files
> exposed to anyone who has a decompiler? What is the best
> way to protect software written in java?

You can decompile/reverse-engineer any program. Java is just (generally) easier to reverse engineer than natively compiled code. The JAD decompiler has a companion obfuscator.

Ray Hopkin

Posts: 3
Nickname: rayhopkin
Registered: May, 2006

Re: Converting .class files to .java files Posted: May 31, 2006 9:58 PM
Reply to this message Reply
Thank you very much folks. This really helps.

david alves

Posts: 1
Nickname: tok3n
Registered: Jun, 2006

Re: Converting .class files to .java files Posted: Jun 2, 2006 4:18 PM
Reply to this message Reply
Modern obfuscator actually do more than just rename the variables, some even create loops that are not possible to create in source code thus preventing, some part of the code at least of being decompiled. any how remember that obfuscation is only valid if you do not intent for others to use your compiled code (who would like to use an API or lib where all the classes and methos were called a,,b,c ... etc.). Anyhow if it is always possible to reverse engineer full compiled languages like c or c++ it is also possible (and easier) to decompile java.

Flat View: This topic has 6 replies on 1 page
Topic: BIRT Report Problem Previous Topic   Next Topic Topic: Detecting SMTP Settings

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use