如何使 Java 程序不可提取

发布于 2024-09-19 03:09:48 字数 134 浏览 2 评论 0原文

抱歉,我不太确定如何陈述问题标题。我的问题是这样的,我开发了一个Java程序,我想将它分发给我的朋友。所以我将其导出到 Jar 文件,但我不希望他们提取 jar 文件来查看代码。无论如何,有没有办法制作该程序,以便没有人可以获得源代码,而只是启动该程序。

Sorry I am not very sure how to state the question title. My problem is like this, I had developed a Java program, and I wish to distribute it to my friends. So I export it to Jar file, but I don't want them to extract the jar file to view the code. Is there anyway to make the program so that nobody can get the source code instead just launch the program.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(7

旧城空念 2024-09-26 03:09:48

您始终可以从编译的类文件中获取原始代码。然而,使用混淆器会使那些希望反编译此类代码的人变得非常困难,因此反编译的代码几乎无法阅读。以下是您可能希望研究的开源 Java 混淆器列表。

You can always get the original code back from compiled class files. However, you can make the lives of those who wish to decompile such code very difficult by using an obfuscator, so the decompiled code is nearly impossible to read. Here is a list of open-source java obfuscators which you might wish to investigate.

尹雨沫 2024-09-26 03:09:48

如果计算机可以运行它,那么人类就可以对其进行逆向工程。

If a computer can run it, a human can reverse engineer it.

世界如花海般美丽 2024-09-26 03:09:48
  1. 您要查找的术语是混淆。最终
最好的情况是,混淆只会使其变得耗时,但并非不可能,

对程序进行逆向工程。

  1. 另一种技术是SaaS。尽管最终使用黑盒技术,SaaS 也是可逆向工程的。
  2. 另一种技巧是信任。由于您要将其分发给您的朋友,因此您可以要求他们不要提取 jar 文件或查看代码。如果他们真的是你的朋友,他们会尊重你的要求。
  1. The term you are looking for is obfuscation. Ultimately
At best, obfuscation merely makes it time-consuming, but not impossible,

to reverse engineer a program.

  1. Another technique is SaaS. Though ultimately using black box techniques SaaS is also reverse-engineerable.
  2. Another technique is trust. Since you are distributing it to your friends, you could ask them to not extract the jar file or view the code. If they are really your friends, they will honor your request.
吃不饱 2024-09-26 03:09:48

事实是没有人想要你的源代码。认为值得付出努力将他们拒之门外的想法是相当傲慢的。

你能做的最好的事情就是混淆视听。

The truth is that nobody wants your source code. It's pretty arrogant to think that it'd be worth the effort required to keep them out.

The best you can do is obfuscate.

难忘№最初的完美 2024-09-26 03:09:48

Jar 文件通常不包含代码。它们通常只包含运行程序所需的.class(字节码)文件。

Jar files typically do not contain code. They usually only contain the .class (bytecode) files necessary to run the program.

不及他 2024-09-26 03:09:48

您似乎将安装应用程序与可执行文件混淆了。我还认为您将 java jar 应用程序与普通的 .exe 混淆了。

即便如此,这些都只是仍然可以反编译的代码包,只是不像解压 jar 文件那么容易,而 jar 文件的设计是为了易于提取。

Java 被设计为在 JVM 上运行,因此将其打包到 .exe 中是一种糟糕的形式,因为这会立即将其锁定到 Windows,这从一开始就违背了 Java 的初衷。所以我建议反对。

正如大家所说,如果你的程序运行良好并且用户喜欢它,他们很少会考虑反编译它。但如果他们愿意,他们只需通过网络搜索即可找到如何操作(无论使用何种语言)。关于商业分发,大多数情况下,软件被混淆并以 .jar 形式分发,并具有 .exe、.app、.bin 等形式的特定于体系结构的启动器。不要将它们与实际的可执行文件混淆,后者通常是.jar 文件某处。

You appear to be confusing the installation application with the executable. And I also think you are confusing a java jar application with a normal .exe.

Even then, these are all just bundles of code which can still be decompiled, it's just not as easy as unpacking a jar file, which are designed to be easy to extract.

Java is designed to run on the JVM, so packing it inside a .exe is poor form as that immediately locks it onto Windows, which defeats the point of Java in the first place. So I would advice against that.

As everyone has stated, it is rare that if your program works well and you users like it, that they would even think to decompile it. But if they want to they are just a single web search from a how to anyway (regardless of the language). With regards to commercial distribution, most cases the software is obfuscated and distributed in it's .jar, with with a architecture specific launcher of the form .exe, .app, .bin etc. Do not confuse those with the actual executable which is generally a .jar file somewhere.

愛上了 2024-09-26 03:09:48

您可以在服务器上执行部分程序。基本上,为了执行程序的一些重要、大型和核心功能,客户端会联系您的服务器来计算该功能。

然后你可以将客户端分发给每个人,并保留服务器代码。只需保持服务器运行即可。然后其他人无法访问整个源代码,但可以执行该软件。

这是唯一可靠的方法。只要付出足够的努力,其他方法就可以通过某些方式规避。

You could execute part of your program on a server. Basically to execute some important, large and central function of your program, the clients contact your server to compute this function.

Then you can distribute the clients to everybody, and keep the server code for your self. Just keep the server running. Then the others can't get access to whole source, but can execute the software.

This is the only sure way to do this. Other ways can be circumvented in some ways with enough effort.

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