Java 私有 jre 和公共 jre 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19510169/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 17:52:25  来源:igfitidea点击:

What are the differences between private jre and public jre?

java

提问by Jako

What are the differences between private jre and public jre? Is there some official paper about this topic?

私有 jre 和公共 jre 有什么区别?有没有关于这个主题的官方论文?

I didn't find any question on SO about this topic. Nor I was able to find something fulfilling around.

我没有发现关于这个主题的任何问题。我也无法在周围找到令人满意的东西。

采纳答案by Manish Doshi

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.

JRE 只不过是一个文件夹,其中包含 JVM 可执行文件、设置文件、所需的 lib 文件和扩展。您可以在您的系统上安装多个 JRE Sun 通常将 C:\Program Files\Java 中的版本安装为 jre,例如.jre1.6.0_06。

公共 JRE 可用于所有 Java 程序、浏览器,并且此 JRE 文件夹中的库可用于在命令行中启动的应用程序,如 java com.sarathonline.cli.HelloWorld 此 JRE 也在路径和浏览器插件中注册。

私有 JRE 是安装在系统中但默认情况下不引用的东西。这可能是另一个安装目录中 JRE/JDK 文件夹的副本。如果您看到我之前的帖子:使用 jre 1.6 启动 eclipse,其中您的环境在 1.4 中,JRE1.6 仅由 Eclipse 使用,这是一个私有 JRE。而JAVA_HOME指向1.4。这是一个公共 JRE。

Source:

来源:

http://blog.sarathonline.com/2008/07/public-and-private-jre.html

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

http://www.velocityreviews.com/forums/t649860-private-vs-public-jre-in-different-oss.html

回答by TwoThe

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").

答案很简单:如果用户想要运行任何 Java,他们将使用公共 JRE。如果显式执行该 Java 二进制文件(例如在 Windows 上:“C:\Programs\Java\MyJava\bin\java.exe”),则私有 JRE 是一种可以使用的不同安装。

回答by Er. Ravi Shanker Mishra

Private JRE ->Private JRE is Used for compilation of Java Application when both Public and private JRE is available and its installation location is defined by user.

Private JRE ->Private JRE 用于在公共和私有 JRE 都可用且其安装位置由用户定义时编译 Java 应用程序。

Public JRE -> Public JRE is used for Execution of Java Application when both Public and private JRE is available....if in case Private JRE is not available then both Compilation and Execution process will be done by Public JRE.

公共 JRE -> 公共 JRE 用于在公共 JRE 和私有 JRE 都可用时执行 Java 应用程序……如果私有 JRE 不可用,则编译和执行过程都将由公共 JRE 完成。

回答by Utku

The official answer, from Oracle:

来自 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).

私有与公共 JRE

安装 JDK 还会安装私有 JRE 和可选的公共副本。运行 JDK 附带的工具需要专用 JRE。它没有注册表设置,完全包含在一个 jre 目录(通常位于 C:\Program Files\jdk1.8.0\jre)中,该目录的位置只有 JDK 知道。另一方面,公共 JRE 可以被其他 Java 应用程序使用,包含在 JDK 之外(通常位于 C:\Program Files\Java\jre1.8.0),在 Windows 注册表中注册(位于 HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft ),可以使用添加/删除程序删除,可以在浏览器中注册,并且可以将 java.exe 文件复制到 Windows 系统目录(这将使其成为默认的系统 Java 平台)。