简体   繁体   English

JDK安装提示再次安装JRE。 jj外部和内部JDK文件夹之间的区别是什么?

[英]JDK installation prompts to install JRE again. What's the difference between jre outside and inside JDK folder?

When I install JDK, after the installation of JDK it also prompts to let you choose another location to install a JRE of the save version. 当我安装JDK时,在安装JDK之后它还会提示您选择另一个位置来安装保存版本的JRE。 But, when the JDK installation is done, we can see a jre folder inside the JDK folder. 但是,当JDK安装完成后,我们可以在JDK文件夹中看到一个jre文件夹。 For example, if we install JDK in: 例如,如果我们在以下位置安装JDK:

C:\Program Files\Java\JDK8

we can see: 我们可以看到:

C:\Program Files\Java\JDK8\jre

and if we choose to save the JRE at: 如果我们选择将JRE保存在:

C:\Program Files\Java\JRE8

we can find this folder contains (nearly) the same content as the jre inside JDK folder. 我们可以发现这个文件夹包含(几乎)与JDK文件夹中的jre相同的内容。 What are the difference between these two? 这两者有什么区别?

As the Oracle Installation Manual suggests in the section " Private Versus Public JRE ": 正如Oracle安装手册在“ Private Versus Public JRE ”部分中所述:

Private Versus Public JRE 私人与公共JRE

Installing the JDK also installs a private JRE and optionally a public copy. 安装JDK还会安装私有JRE和可选的公共副本。 The private JRE is required to run the tools included with the JDK. 私有JRE需要运行JDK附带的工具。 It has no registry settings and is contained entirely in a jre directory (typically at C:\\Program Files\\jdk1.8.0\\jre ) whose location is known only to the JDK. 它没有注册表设置,完全包含在jre目录中(通常位于C:\\Program Files\\jdk1.8.0\\jre ),其位置仅为JDK所知。 On the other hand, the public JRE can be used by other Java applications, is contained outside the JDK (typically at C:\\Program Files\\Java\\jre1.8.0 ), is registered with the Windows registry (at HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft ), can be removed using Add/Remove Programs, might be registered with browsers, and might have the java.exe file copied to the Windows system directory (which would make it the default system Java platform). 另一方面,公共JRE可以被其他Java应用程序使用,包含在JDK之外(通常在C:\\Program Files\\Java\\jre1.8.0 ),在Windows注册表中注册(在HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft ),可以使用“添加/删除程序”删除,可能已在浏览器中注册,并且可能将java.exe文件复制到Windows系统目录(这将使其成为默认的系统Java平台)。

So, we mainly have the same in these two directories, but it's safe to use the public one, or the outer one. 因此,我们在这两个目录中主要有相同的内容,但使用公共目录或外部目录是安全的。 If there's no outer one, we can use the inner one without (programmatical) problem. 如果没有外部的,我们可以使用没有(编程)问题的内部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM