如何保护Jar文件不被反编译? [英] How to protect a Jar file from being decompiled?
问题描述
我正在使用java开发应用程序,但我不打算发布代码。问题是,我测试了其中一个jar反编译器,它能够几乎完美地从我的jar文件中获取代码!
我的问题是如何在不从中提取代码的情况下分发我的jar文件?
I'm developing an application using java but I'm not going to release the code. The problem is, I tested one of these jar de-compilers and it was able to get the code from my jar file almost perfectly! My question is how can I distribute my jar file without my code being extracted from it?
推荐答案
Java保留编译期间的大多数元数据(允许动态加载和反射),它是一个直接反编译(不仅是反汇编)编译的类文件。这就是为什么恢复的代码与原始代码非常相似。
As Java preserves most of the "metadata" during compilation (which allows dynamic loading and reflection), it is a straight forward to decompile (not only disassemble) the compiled class files. That's why the recovered code is very similar to the original.
虽然不完美,但你可能唯一的选择是使用混淆器,例如 ProGuard 。
While not perfect, your probably only option is to use an obfuscator, such as ProGuard.
这篇关于如何保护Jar文件不被反编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!