如何保护 Jar 文件不被反编译? [英] How to protect a Jar file from being decompiled?

查看:37
本文介绍了如何保护 Jar 文件不被反编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆