在客户端计算机上从 java .jar 文件运行标准 exe
我有一个程序想要在客户端计算机上作为 exe 运行。在我用 Java 编写程序后,我使用 Jsmooth 创建 exe。该程序在我自己的本地计算机上运行得非常好,但是当我尝试在另一台计算机上运行相同的程序时,该程序会提示我安装 Java。安装 Java 后,程序仍然要我安装 Java。我认为这可能是不同版本的 Java,但我用 Java 的 LTS 最多编译了 Jar,并且我的 JRE 是最新版本。我应该怎么办?
I have a program that I want to run as an exe on a clients computer. After I made my program in Java I used Jsmooth to create the exe. The program runs perfectly fine from my own local computer, but when I try running the same program on another computer the program prompts me to install Java. After installing Java, the program STILL wants me to install Java. I thought it might be different versions of Java, but I compiled the Jar with the most LTS of Java, and my JRE was on the most recent version. What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JVM 相当大。因此,JSmooth 不包含开箱即用的功能。我想你可以通过说明哪个路径包含与可执行文件相关的路径来询问它(我可能记得 exe4j,一种不同的工具,它与 jsmooth 执行相同的操作)。不过,您不能将其直接折叠到exe中。然后,这将是一个安装过程,您最终会看到:
其中“Anthony.exe”是由 JSmooth 制作的,并且您告诉 JSmooth 它应该使用位置
".\jre"
中找到的 JRE 。那应该仍然有效。
更普遍的问题是整个部署模型或多或少已经过时了; JRE 已经不存在了,至少,oracle/team openjdk 已经停止生产它们,并且不再提及这个概念,但一些第三方部署者(例如 Azul)仍然生产它们。 Java1.8是最后一个真正可以说具有JRE概念的版本。
JDK 是 JRE 的超集(它拥有 JRE 所拥有的一切,甚至更多),并且 JDK 仍然存在,因此您应该能够发布整个 JDK。
新的模型是jlink、模块和treeshaking,而且感觉像JSmooth 等任何exe 生成器项目都没有针对它进行更新。一般来说,java 在服务器上使用较多,但在桌面上使用 java 的情况并不多。如果你想深入研究这些——你有大量的阅读要做,而且体验并不像 JSmooth 那样顺利(呵呵)。
JVMs are quite large. Out of the box, JSmooth therefore doesn't include one. I think you can ask it (I'm recalling exe4j perhaps, a different tool that does the same thing as jsmooth), by stating which path contains one relative to the executable. You cannot fold it straight into the exe, though. It'll then be an installation process where you end up with:
Where 'Anthony.exe' is made by JSmooth, and you told JSmooth that it should use the JRE found in location
".\jre"
.That should probably still work.
The more general problem is that the entire deployment model is more or less obsolete; JREs do not exist anymore, at least, oracle/team openjdk has ceased producing them and has ceased mentioning the very concept, but some third party deployers such as Azul still produce them. Java1.8 is the last version that can truly be said to have had the concept of a JRE.
A JDK is a superset of a JRE (It has everything a JRE has, and more), and JDKs still exist, so you should just be able to ship an entire JDK.
The new model is
jlink
, modules, and treeshaking, and it doesn't feel like any of the exe maker projects such as JSmooth have been updated for it. In general, java is used a ton on servers, but java on the desktop is not observed that much. If you want to delve into those - you have a lot of reading to do, and the experience is not as smooth (heh) as JSmooth.