What is the best way to go about obfuscating Java code? [duplicate]
Possible Duplicate:
Best Java obfuscator ?
Well, I'm planning on releasing a Jar into the world but would prefer if the code was not readably available to anyone with a Java Decompiler as I want to control access to the program with usernames / auth codes etc.
After some Googling I haven't found any software to do this for me, so I was wondering what steps to take from here; if anyone can point me at any software or information on methodologies of obfuscation I would be grateful.
开发者_JAVA技巧Cheers again Stack Overflow.
There are many obfuscators around, ProGuard is one well known example. Try searching for "java obfuscator", google finds enough hits on that.
It's not possible to prevent someone from decompiling your code. You can obfuscate it, but that's the best you can do.
The good news for you?
Nobody wants your code. It's probably not worth decompiling.
If companies like BEA don't prevent such a thing with WebLogic, I can't see why yours requires it. Release your JAR and sleep at night.
Do not forget to encrypt the passwords using a hash algorithm. I would not rely on the obfuscator to protect the passwords.
And you can then probably skip the obfuscator all together as it will provide little, if any, additional protection.
精彩评论