JDK, JRE, JVM Detailed

The JDK , the JRE, the JVM Detailed

 

From the relationship between the terms contained in  the JDK> the JRE> the JVM .

Conceptually JDK is a JAVA development tool , use it to develop the JAVA program.

JAVA JRE is the runtime environment , developed in JAVA JRE can run as long as the program.

JVM is a JAVA virtual machine is part of the JRE, for the operation of JAVA classes are basically done on the JVM.

 

JDK 

       JDK (Java Development Kit) is the core of JAVA, including the Java Runtime Environment (Java Runtime Envirnment, a bunch of Java tools (javac / java / jdb, etc.) and Java-based libraries (Java API that is included rt.jar).

      JDK is a JAVA Development Kit, which is used to develop the JAVA program, the programmer is required to use the java language java Development Kit is available to programmers. 

JDK directory:

bin: the most important is the compiler (javac.exe)

include: the header files and java to interact with the JVM

lib: library jre: java runtime environment

(Note: bin here, lib and jre folders in the bin, lib is different)

 

JRE

      JRE (Java Runtime Environment, Java Runtime Environment), is a collection of programs that must be run JAVA environment, including the JVM and Java-based standard implementation class libraries.

      JAVA runtime environment, developed JAVA JRE can run as long as the program is the use of java language programs needed to run the software environment is available to want to run java program users.

      JRE status as a PC, we write the Win64 application requires an operating system to help us run the same, Java programs must also be written in our JRE to run. 

 

Overall JDK java program is used to develop, but can only run jre is not compiled .class and function.

 

JVM

       JVM (Java Virtual Machine), that is java virtual machine, java runtime environment, which is the core part of the whole java cross-platform, all the java program will first be compiled into .class class file, this file type can execute on a virtual machine.

 

Graphic:

 

 

Java language features cross-platform

 Let me talk about Java build process:

The first Java compiler: java source code to go through javac compiler into binary .class bytecode files,

Second compile Java: .class file and then run on the jvm, java interpreter (a part of the jvm) will be interpreted into machine code corresponding to the execution platform.

        So-called cross-platform java is different jvm installed on different platforms, generated on different platforms .class bytecode files are the same (cross-platform java is cross finger .class bytecode files platform, .class files bytecode is platform-independent), Java virtual machine byte code, when executed, the bytecode interpreter into machine instructions executed on a particular platform. This is Java's ability to "compile once, run anywhere" reasons.

       JVM mask information associated with a particular operating system platform, so that only the Java program to generate object code (bytecode) running in the Java virtual machine can run without modification on multiple platforms.

Graphic:

Bytecode

       Byte code (Bytecode) comprising a program executed by a sequence of op code / data of the binary composition. Bytecode is an intermediate state (intermediate code) binary code (files), which is more abstract than the machine code, the interpreter needs to be translated to machine code of the intermediate code.

Machine code

       Machine code (machine code), scientific name of machine language instructions, sometimes referred to as native code (Native Code), the CPU of the computer can directly interpret the data, the fastest.

 

1.JDK, JRE, JVM three contact:

        JVM不能单独搞定class的执行,解释.class的时候JVM需要调用解释所需要的类库lib。在JDK下面的的jre目录里面有两个文件夹bin和lib,在这里可以认为bin里的就是jvm,lib中则是jvm工作所需要的类库,而jvm和 lib和起来就称为jre。JVM+Lib=JRE。

        总体来说就是,我们利用JDK(调用JAVA API)开发了属于我们自己的JAVA程序后,通过JDK中的编译程序(javac)将我们的文本java文件编译成.class字节码,在JRE上运行这些字节码,JVM解析这些字节码,映射到CPU指令集或OS的系统调用。

2.JDK、JRE、JVM三者区别:

        a.JDK和JRE区别:在bin文件夹下会发现,JDK有javac.exe而JRE里面没有,javac指令是用来将java文件编译成class文件的,这是开发者需要的,而用户(只需要运行的人)是不需要的。JDK还有jar.exe, javadoc.exe等等用于开发的可执行指令文件。这也证实了一个是开发环境,一个是运行环境。

        b.JRE和JVM区别:JVM并不代表就可以执行class了,JVM执行.class还需要JRE下的lib类库的支持,尤其是rt.jar。

 

 

参考链接:

https://www.cnblogs.com/xiaocao123/p/10534710.html

https://blog.csdn.net/ancientear/article/details/79483592

https://bbs.csdn.net/topics/190099909

https://www.cnblogs.com/zhangzongxing01/p/5559126.html

https://www.cnblogs.com/qiumingcheng/p/5400265.html

 

 

Guess you like

Origin www.cnblogs.com/here-I-am/p/11582280.html