[英]How to run java applications JDK13 on JRE?
I have made an a java app with JDK 13. I created a exe file with launch4j.我用 JDK 13 制作了一个 java 应用程序。我用 launch4j 创建了一个 exe 文件。 But nobody can run it because everyone has the jre 1.8 version and it wont start... I has to include the java jdk 13 with installation and set the java_home with that?
但是没有人可以运行它,因为每个人都有 jre 1.8 版本并且它不会启动......我必须在安装中包含 java jdk 13 并设置 java_home 吗?
TL;DR - If you want to distribute a Java 13 application, the best option is to use jlink
to create the executable. TL;DR - 如果您想分发 Java 13 应用程序,最好的选择是使用
jlink
创建可执行文件。 This avoids the user having to install any JDK or JRE to run your code.这避免了用户必须安装任何JDK 或 JRE 来运行您的代码。
Clearly, users cannot run your application with a Java 8 JRE or JDK.显然,用户无法使用 Java 8 JRE 或 JDK 运行您的应用程序。 A typical Java 13 application will make use of features that are not present in the Java 8 platform.
典型的 Java 13 应用程序将利用 Java 8 平台中不存在的功能。 But even if it worked, free Java 8 will be end-of-life in April 2021, and at that point:
但即使它有效,免费的 Java 8 也将在 2021 年 4 月结束生命周期,届时:
It will stop getting security updates, making it (in theory if not practice) unsafe for your customers to use.它将停止获取安全更新,使其(理论上如果不是实践的话)对您的客户使用不安全。
It will be more difficult for your customers to find free Java 8 binaries.您的客户将更难找到免费的 Java 8 二进制文件。 (Paying Oracle for a license will be an option though.)
(尽管可以选择为许可证支付 Oracle。)
But Java 13 is problematic too.但是 Java 13 也有问题。 That will be end-of life in September 2020, And besides.
这将在 2020 年 9 月结束生命,此外。 JRE distributions are no longer available.
JRE 发行版不再可用。
Finally, application installers with embedded JREs were always somewhat problematic:最后,带有嵌入式 JRE 的应用程序安装程序总是有些问题:
It was easy for software suppliers to forget to update the installer when there was a security patch to the JRE.当 JRE 有安全补丁时,软件供应商很容易忘记更新安装程序。
It was difficult for system administrators to add the embedded JRE to the list of things that were automatically updated.系统管理员很难将嵌入式 JRE 添加到自动更新的列表中。 Especially if they allowed end-users to install the application for themselves.
特别是如果他们允许最终用户自己安装应用程序。
The best approach will be to do the following:最好的方法是执行以下操作:
jlink
to create the distributable for your application for all platforms that you supportjlink
为您支持的所有平台的应用程序创建可分发文件 If you don't want use jlink
, another alternative would be to develop your code to run on Java LTS releases.如果您不想使用
jlink
,另一种选择是开发您的代码以在 Java LTS 版本上运行。 (The current LTS release is Java 11, and the next one will be Java 17 which is planned for September 2021.) (当前的 LTS 版本是 Java 11,下一个版本是 Java 17,计划于 2021 年 9 月发布。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.