Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between jre folder under JDK folder and jre folder?

  • NOTE: The question is not about the difference between JDK and JRE.

Oh, I am sorry. The question is not discuss about JDK and JRE. But I cannot express clearly in my title. So I try to explain in here.

I want to know the difference between two folders!

C:\Program Files\Java\jdk1.8.0_161\jre and C:\Program Files\Java\jre1.8.0_161

Describe in details:

I am new to JAVA. I have installed the JDK in my Windows 10. When I install jdk, there were two steps. After double click jdk-8u161-windows-x64.exe, two steps as follows:

  1. Step 1: install jdk. (In C:\Program Files\Java\jdk1.8.0_161)

  2. Step 2: install jre. (In C:\Program Files\Java\jre1.8.0_161)

But when I open the jdk1.8.0_161 folder. I can also find a jre folder.

Could anyone tell me the difference between C:\Program Files\Java\jdk1.8.0_161\jre and C:\Program Files\Java\jre1.8.0_161?

If they are the same, why is jre installed in the installation process of jdk ? Are they duplicated?
In other world, is Step 2 needless?

like image 722
JosanSun Avatar asked Jan 22 '18 06:01

JosanSun


1 Answers

The JRE within the JDK C:\Program Files\Java\jdk1.8.0_161\jre (also referenced as private JRE) is used by the JDK tools. The JRE outside C:\Program Files\Java\jre1.8.0_161 (also referenced as the public JRE) should is meant to be used by the Java applications.

private JRE

  • contains the library (attach.dll) needed for the use of the attach API
  • will be uninstalled with the JDK

public JRE

  • registers the Java Plug-in and the java web start in the browsers
  • this JRE is registered in the system, e.g. as runtime for Java applications, the Java control panel
  • can be uninstalled separately from JDK
like image 198
SubOptimal Avatar answered Oct 21 '22 03:10

SubOptimal