构建一个只能执行的JAR文件?

发布于 2024-12-12 05:38:46 字数 89 浏览 0 评论 0原文

我的项目尚未完成,但我想分发一些演示版本。

有没有办法制作一个可执行的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

℉絮湮 2024-12-19 05:38:46

不,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:

  • Try converting it into a native executable (there are a few tools to do that)
  • Run an obfuscator over it (there's even more tools for that)

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.

懒猫 2024-12-19 05:38:46

您唯一的希望在于混淆或加密。就防范坚定的扑克玩家而言,这也不是那么令人敬畏。你确定值得吗?

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.

凝望流年 2024-12-19 05:38:46

您是否尝试过 Eclipse 中的 Export>Java>Runnable JAR file 选项?

Did you try Export>Java>Runnable JAR file option in Eclipse?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文