如何在Java 11中使用没有jre的jdk [英] How to use jdk without jre in Java 11

查看:764
本文介绍了如何在Java 11中使用没有jre的jdk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们计划将Java 8项目迁移到使用Java 11.但是我注意到Java 11没有JRE文件夹。

We are planning to migrate our Java 8 project to use Java 11. But I noticed that Java 11 doesn't have a JRE folder.

在Java 9和Java 10中,文件夹结构已更改,即 java \ _jdk1.x java \ jre1.x ,其中 x 是java 9或10。

In Java 9 and Java 10, folder structures are changed i.e. java\jdk1.x or java\jre1.x, where x is java 9 or 10.

但是在Java 11中,我只获得了一个文件夹,即 java \ _jdk-11 。我的客户如何在没有jre的情况下使用我的应用程序?

But in Java 11, I am getting only one folder, i.e. java\jdk-11. How will my client use my application without jre?

我所理解的是Java 11正在强制模块化我们的应用程序,并且需要使用jlink来创建我们自己的jre在客户端运行应用程序。

What I understood is that Java 11 is enforcing to modularize our application, and using jlink is needed to create our own jre to run the application in client.

我的理解是否正确?

推荐答案

20年来,JDK附带了一个JRE,它只是安装在系统上不同目录中的一部分功能。

For 20 years, the JDK shipped with a JRE which was just a subset of its functionality installed in a different directory on your system.

实际上,它附带了TWO相同的JRE,一个安装在JDK安装目录中,另一个安装在它外面。

In fact, it shipped with TWO identical JREs, one installed inside the JDK installation directory and one outside it.

这一直困扰着我,因为它完全浪费了维护人员的努力这样就完全浪费了你安装它的计算机上的磁盘空间,因为JRE只是复制了JDK已经可以做的一些事情。

This has always puzzled me as it's a complete waste of effort on the part of the maintainers to make this so, and a complete waste of disk space on the computer you install it on, as that JRE just duplicates some of the things the JDK can do already.

最后,在Java 11中,Oracle和OpenJDK团队决定结束这种愚蠢行为并且只发布一个t兴,JDK。
安装时这个JDK在硬盘上实际上比以前的旧JRE要小,甚至删除了一些有效的参数,你想要一个单独的JRE用于磁盘空间有限的设备,这个参数从未解释过为什么2个JRE首先安装一个JDK,但是为了证明需要将JRE作为JDK的精简运行时环境。

Finally, with Java 11, Oracle and the OpenJDK team decided to end this silliness and just distribute a single thing, the JDK. This JDK when installed is actually smaller on your hard disk than the old JRE alone used to be, removing even the somewhat valid argument that you'd want a separate JRE for devices with limited disk space, an argument that never explained why 2 JREs would be installed with a single JDK in the first place but was made to justify the need for a JRE as a stripped down runtime environment for the JDK.

Ergo ,不需要单独的JRE,并且很长一段时间都没有,更不用说包括并强行安装它作为JDK安装的一部分。

Ergo, there is no need for a separate JRE, and there hasn't been one for a long time, let alone for including and forcibly installing it as part of the JDK installation.

不,你不需要创建自己的JRE。只需在客户端计算机上安装OpenJDK,并确保将$ JAVA_HOME / bin添加到系统路径,就像使用旧JRE一样。

And no, you don't need to create your own JRE. Just install the OpenJDK on the client machines and make sure you add the $JAVA_HOME/bin to the system path, just as you had to do with old JREs.

哦,剥离任何java * .exe文件的Windows目录树,其中旧JRE安装程序的某些版本不会放在那里,以及系统路径也有一些JRE安装程序添加了一些奇怪的条目。

And oh, strip the Windows directory tree of any java*.exe files which some versions of the old JRE installer were wont to place there, as well as the system path which also had some weird entries added by some JRE installers.

这篇关于如何在Java 11中使用没有jre的jdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆