Newer versions of JDK have a "private" JRE?

  • Java
  • Thread starter Wrichik Basu
  • Start date
  • Tags
    java
In summary, the conversation discusses the differences between private and public JREs and the reasoning behind eliminating standalone JREs. It also provides instructions on how to access the private JRE from the command line and explains how NetBeans was still able to execute programs without a standalone JRE.
  • #1
Wrichik Basu
Science Advisor
Insights Author
Gold Member
2,116
2,691
I had JDK 12.0.1 for some time and recently upgraded to JDK 13.0.1. During the installation, this screen was shown:

jdk13.png

I know that newer versions of JDK have no accompanying separate JRE; the standalone JRE currently available is 1.8.0u231. But what is the story about this "private" JRE? How to access it from command line?

Some months ago, while developing a GUI application in NetBeans using JDK 12.0.1, I had discovered that while I can run the application within NetBeans, I cannot execute the .jar file outside the IDE in terminal. This was because I did not have a standalone JRE at that point of time. But NetBeans was still executing the programs. Was it using this "private" JRE?
 
Technology news on Phys.org
  • #2
Wrichik Basu said:
But what is the story about this "private" JRE?

The private JRE is required to run the tools included with the JDK, i.e. it is only for the JDK. It has no registry settings - talking about Windows. Also, it is contained entirely in its own jre directory. Its location is known only to the JDK.

The public JRE on the other hand, can be used by other Java apps, it exists outside the JDK and it is registered with the Windows Registry. If java.exe file is copied to the Windows System directory, it becomes the default system Java platform.

As for why not a standalone JRE from Java 11 on, there are some pretty fair reasons, at least from a company perspective:

The JRE is not a real part of OpenJDK i.e. it is a Sun (and Oracle later on) creation. So, by eliminating it makes this difference between Oracle JDK and OpenJDK disappear. Second, there was a removal of some client deployment technologies, so there is no primary reason for JRE existence anymore. Also, JRE is not a means to accomplish a small footprint anymore, for various reasons beginning from Java 9.

Wrichik Basu said:
How to access it from command line?

JAVA_HOME environment variable should exist (or created, if not) and be set to point to the directory where the JDK software is located. Also, you have to update the system path. You can find very easily how to do it by googling it, in case you don't know.

Wrichik Basu said:
Some months ago, while developing a GUI application in NetBeans using JDK 12.0.1, I had discovered that while I can run the application within NetBeans, I cannot execute the .jar file outside the IDE in terminal. This was because I did not have a standalone JRE at that point of time. But NetBeans was still executing the programs. Was it using this "private" JRE?

See above about private JRE.
 
  • Informative
Likes Wrichik Basu

What is a "private" JRE in newer versions of JDK?

A "private" JRE in newer versions of JDK refers to a copy of the Java Runtime Environment (JRE) that is bundled with the JDK installation package. This allows developers to run Java applications without having to separately download and install a JRE.

Why was the "private" JRE added in newer versions of JDK?

The addition of a "private" JRE in newer versions of JDK was mainly for convenience and to simplify the installation process for developers. It also ensures that the JRE used to run Java applications is consistent and in sync with the JDK version being used.

Can I still use a separate JRE with newer versions of JDK?

Yes, it is still possible to use a separate JRE with newer versions of JDK. However, the "private" JRE is the default option and will be used unless specifically configured to use a separate JRE.

What are the benefits of using the "private" JRE in newer versions of JDK?

The "private" JRE in newer versions of JDK offers several benefits, including easier installation and maintenance, better compatibility between JDK and JRE versions, and improved security as the "private" JRE is only accessible to the developer.

Can I customize the "private" JRE in newer versions of JDK?

Yes, it is possible to customize the "private" JRE in newer versions of JDK by adding or removing modules. This can be done during the installation process or afterwards through the JDK's jlink tool.

Similar threads

  • Programming and Computer Science
Replies
3
Views
4K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
3
Views
15K
  • Programming and Computer Science
Replies
4
Views
19K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
9
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
3K
Back
Top