gpt4 book ai didi

java - 即使JDK包含JRE,还需要JRE吗?

转载 作者:行者123 更新时间:2023-12-01 07:48:01 29 4
gpt4 key购买 nike

抱歉,如果这些是非常愚蠢的问题,因为我是java新手。JDK内部包含了JRE,那么如果是一个独立的应用程序,还需要JRE吗?

最佳答案

并不是每个人都想构建 Java 应用程序(这是 JDK 的用途)。许多人只是想运行它们(这是 JRE),例如获得 JAR 文件的最终用户。

例如:在我的国家,电子报税是通过 Java 应用程序完成的。用户需要 JRE 来运行程序(他们可以在其中填写和提交表单),但不需要整个 JDK。

编辑:根据OP的评论,真正的问题是为什么JDK包含一个额外的JRE。我做了一些研究,发现Oracle's explanation :

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

关于java - 即使JDK包含JRE,还需要JRE吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46041469/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com