class decompiler

Hi,

I found some Java decompilers that can regenerate the original source code from a class file.

I've tested it already and the result was really amazing and frightining too!

How can I protect my class file from being de-compiled, and prevend my code from being stolen?

Please advise.

tamer

[351 byte] By [Tamer] at [2007-9-26 2:37:04]
# 1

There isn't anything that can be done to prevent someone from decompiling code, but you can make it difficult to read the decompiled code.

There are many utilities that you can find (try any java utilities site) that will help prevent others from being able to make sense of the source code. They work by changing all of the variable names into cryptic names (e.g. a1, a2, a3...) and doing other such things.

milespj at 2007-6-29 10:05:51 > top of Java-index,Archived Forums,Java Programming...
# 2

Hi,

You can make use of something called an Obfuscator. This again is not 100 % protection but it makes the decompiled code very hard to understand.

Java Compiler from sun itself has an Obfuscation option...

javac -O MyCode.java

..though it is generally referred to as the optimization option and is not a very good obfuscator.

Here is a Tip on obfuscators from Java world. Check it out...

http://www.javaworld.com/javatips/jw-javatip22i.html

Hope this helps.

Thanks and Best Regards,

Manish

javax.pert at 2007-6-29 10:05:51 > top of Java-index,Archived Forums,Java Programming...
# 3
i've tried the -O option, but still it is showing teh original code ... I think SUN should do something against that!
Tamer at 2007-6-29 10:05:51 > top of Java-index,Archived Forums,Java Programming...
# 4
From the tool docs: Note: the -O option does nothing in the current implementation of javac and oldjavac.
jsalonen at 2007-6-29 10:05:51 > top of Java-index,Archived Forums,Java Programming...
# 5

No matter what you do, if someone really wants to, he can reverse engineer the code. If you encrypt it, it'll just take a little bit longer, but since few of us here write very valuable code that must not be in the wrong hands, it's kind of useless to go through all that trouble when nobody even cares about your code.

Kayaman at 2007-6-29 10:05:51 > top of Java-index,Archived Forums,Java Programming...
# 6
Well every code is valuable, and when u develop comercial applicatios, then u need to make sure that your ideas won't be in the compititors hands... i this is the very logical regardless of any other importance!!
Tamer at 2007-6-29 10:05:51 > top of Java-index,Archived Forums,Java Programming...
# 7
I doubt most of us have any code that is so valuable that nobody can guess the algorithm except by browsing the code itself. You can usually guess how most applications (including commercial ones) do what they do.
ArikKfir at 2007-6-29 10:05:51 > top of Java-index,Archived Forums,Java Programming...