码迷,mamicode.com
首页 > 编程语言 > 详细

【Java基础】JDK、JRE、JVM区别

时间:2017-10-14 18:34:03      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:note   mic   sip   调试器   eclips   row   工具   file   include   

JRE : Java Runtime Environment, Java 运行环境,JRE由JVM,Java运行时类库,动态链接库等组成;

JDK : Java Development ToolKit,Java开发工具包(包含了编译器,调试器,javadoc等),用于开发和运行Java程序;

JVM : Java Virtual Machine, Java 虚拟机,负责将编译产生的字节码转换为特定的机器代码行;

JVM作为JRE的一部分,它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来实现的。
JVM有自己完善的硬件架构,如处理器、堆栈、寄存器等,还具有相应的指令系统。JVM 的主要工作是解释自己的指令集(即字节码)并映射到本地的 CPU 的指令集或 OS 的系统调用。Java语言是跨平台运行的,其实就是不同的操作系统,使用不同的JVM映射规则,让其与操作系统无关,完成了跨平台性。JVM 对上层的 Java 源文件是不关心的,它关注的只是由源文件生成的类文件( class file);

Java语言使用Java虚拟机屏蔽了与具体平台相关的信息,使得Java语言编译程序只需生成在Java虚拟机上运行的目标代码(字节码),就可以在多种平台上不加修改地运行。Java虚拟机在执行字节码时,把字节码解释成具体平台上的机器指令执行。这就是Java的能够“一次编译,到处运行”的原因。

由于eclipse,idea等开发工具都有自己内置的编译器而不是JDK的bin目录中自带的编译器,所以在安装时,他们只需要JRE就可以了,但是 Eclipse 只是一个平台,也许你用到的其他东西(比如 maven )有需要 JDK 的也说不定;

 

细心的我们可能会发觉,在JDK里也有一份JRE,一般这个被称为private JRE,另外的那一个被称为public JRE。而private JRE一般都是JDK内部自己调用;

具体参考:http://javaconceptoftheday.com/jdk-installation/

Public JRE is a Standalone JRE. Any java application running on your system can use this JRE. It can be uninstalled seperately from JDK. 
Private JRE is installed inside JDK folder (C:\Program Files (x86)\Java\jdk1.7.0_25\jre). It is used by the tools like javac etc.

参考oracle官网详细介绍:http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html#private

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

 

 参考:http://www.jianshu.com/p/f98c3acd8df8

http://www.iteye.com/topic/614163

https://openhome.cc/Gossip/JavaEssence/WhichJRE.html

http://www.cnblogs.com/PengLee/p/3970760.html

http://www.jianshu.com/p/ebe7456e0aea

 

【Java基础】JDK、JRE、JVM区别

标签:note   mic   sip   调试器   eclips   row   工具   file   include   

原文地址:http://www.cnblogs.com/xiaozhang2014/p/7667779.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!