Search code examples
javajarobfuscationsource-code-protection

How to prevent jar decompilation


I have created a plugin project in Eclipse, distributed as a jar. The user can take this jar and decompile it using JAD. Is there any way so that i can stop the decompilation of a jar file? Or, at least, to hide my source code from the user?


Solution

  • If you don't insert your source code in the jar, your sourcecode isn't what is decompiled by a decompiler, but something similar.

    However, you may use an obfuscator to make code decompilation produce very ugly code like Proguard.

    ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

    Search for other products with the term obfuscator.