简体   繁体   English

如何防止jar反编译

[英]How to prevent jar decompilation

I have created a plugin project in Eclipse, distributed as a jar. 我在Eclipse中创建了一个插件项目,以jar形式分发。 The user can take this jar and decompile it using JAD. 用户可以使用这个jar并使用JAD对其进行反编译。 Is there any way so that i can stop the decompilation of a jar file? 有什么办法可以阻止jar文件的反编译吗? Or, at least, to hide my source code from the user? 或者,至少,从用户隐藏我的源代码?

The best way to stop your jar from being decompiled is to give users no reason to want to. 阻止jar被反编译的最好方法是让用户没有理由想要。 Obfuscation is just a bandaid. 混淆只是一个绷带。 In fact, some people will probably reverse it just for the challenge if it's famous enough. 事实上,如果它足够有名,有些人可能会因为挑战而逆转它。

If you don't insert your source code in the jar, your sourcecode isn't what is decompiled by a decompiler, but something similar. 如果您没有在jar中插入源代码,那么源代码不是反编译器反编译的内容,而是类似的内容。

However, you may use an obfuscator to make code decompilation produce very ugly code like Proguard . 但是,您可能会使用混淆器来使代码反编译产生非常难看的代码,如Proguard

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. ProGuard是一个免费的Java类文件收缩器,优化器,混淆器和预验证器。 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. 最后,它预先验证了Java 6或Java Micro Edition的已处理代码。

Search for other products with the term obfuscator . 使用术语混淆器搜索其他产品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM