简体   繁体   中英

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. But, when the JDK installation is done, we can see a jre folder inside the JDK folder. For example, if we install JDK in:

C:\Program Files\Java\JDK8

we can see:

C:\Program Files\Java\JDK8\jre

and if we choose to save the JRE at:

C:\Program Files\Java\JRE8

we can find this folder contains (nearly) the same content as the jre inside JDK folder. What are the difference between these two?

As the Oracle Installation Manual suggests in the section " Private Versus Public JRE ":

Private Versus Public JRE

Installing the JDK also installs a private JRE and optionally a public copy. The private JRE is required to run the tools included with the 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. 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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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