What are the differences between private jre and public jre? Is there some official paper about this topic?
I didn't find any question on SO about this topic. Nor I was able to find something fulfilling around.
JRE = JVM + set of libraries. So to run the JVM based programs, the JRE is a minimum requirement. JRE is also platform dependent. That means we have different JRE versions for different platforms.
JDK(Java Development Kit) is used to develop Java applications. JDK also contains numerous development tools like compilers, debuggers, etc. JRE(Java Runtime Environment) is the implementation of JVM(Java Virtual Machine) and it is specially designed to execute Java programs.
JRE identifies all the helpful class libraries needed for execution, while JVM is a subclass of JRE that decodes the bytecode into machine language and other minor tasks. JVM and JRE do not participate in development processes like debugging and compiling; JDK is used for them.
JRE is the environment (standard libraries and JVM) required to run Java applications. JDK is the JRE with developer tools and documentations. OpenJDK is an open-source version of the JDK, unlike the common JDK owned by Oracle.
A JRE is nothing but a folder that contains JVM executables, setting files, required lib files, and extensions. You can install multiple JREs on your system Sun generally installs versions in C:\Program Files\Java as jre eg.jre1.6.0_06.
A Public JRE is available to all Java programs, Browsers, and the libs in this JRE folder are available to applications started in command line like java com.sarathonline.cli.HelloWorld This JRE is also registered in path, and Browser plugin.
A Private JRE is something that is installed in the system but is not referred to by default. This could be a copy of the JRE / JDK folder from another installed directory. If you see a my earlier post: starting eclipse with jre 1.6 where your environment is in 1.4, The JRE1.6 is used only by Eclipse, this is a private JRE. While the JAVA_HOME points to 1.4. This is a public JRE.
Source:
http://blog.sarathonline.com/2008/07/public-and-private-jre.html
Some more discussion on the topic:
http://www.velocityreviews.com/forums/t649860-private-vs-public-jre-in-different-oss.html
The official answer, from Oracle:
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).
The answer is very simple: the public JRE is the one users will use if they want to run anything Java. The private JRE is a different installation that one can use, if the explicitly execute that Java binary (e.g. on Windows: "C:\Programs\Java\MyJava\bin\java.exe").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With