构建一个只能执行的JAR文件?
我的项目尚未完成,但我想分发一些演示版本。
有没有办法制作一个可执行的 JAR 文件,但不允许用户访问其类(例如,当导入到 Eclipse 中时)?
My project isn't complete, but I'd like to distribute some demo versions.
Is there a way to make a executable JAR file that won't give users access to its classes (e.g. when imported into Eclipse)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,jar 文件是一个 zip 文件,没有办法阻止用户查看它的内部 - 因为 JVM 需要查看它的内部才能运行它。
但是,您可以:
我对混淆器的经验是,它们做得不够好真正阻止真正热心的人。我尝试过在各种混淆的类上运行反编译器,它们仍然很容易理解。
如果您对本机 exe 路径感兴趣,请阅读本文 可能有帮助。
总的来说,我认为不值得追求。如果你所分发的东西对你所给予的人来说足够有价值,那么如果他们愿意的话,他们就会找到一种方法来挖掘内部。或者,如果他们值得信赖,那么他们就不会。但技术解决方案可能不会改变这一点。
No, a jar file is a zip file and there's no way to stop your users from looking inside it - because the JVM needs to look inside it to run it.
You can however:
My experience with obfuscators are that they don't do a good enough job to acutally stop someone who's really keen. I've tried running decompilers over a variety of obfuscated classes and they're still easy enough to understand.
If you're interested in the native exe path, then this article might help.
Generally speaking, I don't think it's worth pursuing. If what you're distributing it valuable enough to the people you're giving it to, then they'll find a way to dig inside if they want to. Or if they're trustworthy then they won't. But technological solutions probably won't change that.
您唯一的希望在于混淆或加密。就防范坚定的扑克玩家而言,这也不是那么令人敬畏。你确定值得吗?
ProGuard 是一个免费的混淆器(除其他外)。加密器使用自定义类加载器在加载时解密加密的字节代码。
Your only hopes lie through obfuscation or encryption. Neither is all that awesome in terms of protection against a determined poker-arounder. You sure it's worth it?
ProGuard is a free obfuscator (among other things). Encryptors use custom classloaders to decrypt encrypted byte code on loading.
您是否尝试过 Eclipse 中的 Export>Java>Runnable JAR file 选项?
Did you try Export>Java>Runnable JAR file option in Eclipse?