JDK, JRE, JVM overview

1. JDK

1 Overview

The abbreviation of Java Development Kit, Javathe toolkit for development, is the core of the entire JAVA, including the Javaruntime environment (Java Runtime Environment), a bunch of Java tools (javac/java/jdb, etc.) and Java-based class libraries (ie, Java APIs). Including rt.jar), JDK=JRE+ development toolset (such as Javac compilation tools, etc.), provided by SUN. Every Java learner will first install a JDK on the machine, because it provides a compilation and running environment for Java program development , and all Java program writing depends on it. Using the JDK, Java programs can be written as bytecode files, ie .class files.

2. Subdirectory Description

There are six folders, a src class library source code package, and several other declaration files under the directory.
Among them, the important ones are the following four folders: bin, jre, include, lib .

bin : Development tools, including tools and utilities used to develop, execute, and debug Java programs, as well as class libraries and support files required for development tools, the most important being the compiler (javac.exe)

jre : The runtime environment, which implements the Java runtime environment. Is the environment necessary to run Java programs. JRE contains the Java Virtual Machine JavaTM Virtual Machine (JVM), Java core class library and supporting files.
If you are just running Java programs, you only need to install the JRE. If you want to develop a Java program, you need to install the JDK, and you do not need to install the JRE, because the JRE is already included in the JDK.

include : The header file for java and JVM interaction, which supports native code programming using the Java native interface and the Java virtual machine debugging interface. Since JDK is implemented by C and C++, some header files of C language need to be introduced at startup, so there are some header files for C language in the include directory. The header files of C language support Java native interface and Java virtual native programming techniques for the machine debugger interface.

lib : lib is an abbreviation for library (class library). Stored are archived package files used by development tools. For example, jar package, etc.,

Note: The bin and lib folders here are different from the bin and lib in jre

2. JRE

1 Overview

JRE(Java Runtime Environment, Java Runtime Environment), including JVMstandard implementation and Java core class library, JRE=JVM+JavaSE标准类库. It is the running environment of Java, so to execute any Java program, it needs to be installed on the machine JRE, which is the minimum requirement. But it's not a development environment, so it doesn't include any development tools (such as compilers and debuggers), in short, if you're a Java application developer writing code, you'll need to install JDKit, if you just want to run Java builds Application, you only need to install it JRE, it JDKis used for the development of java programs, but JREit can only be run .classwithout the function of compiling.
JREIt can be downloaded as JDKpart of it or it can be downloaded separately, JREdepending on the platform, which means that depending on the machine type (OS and architecture), the JRE package to import and install must be selected.
For example: you can't install 64-bit on JREa 32-bit machine, and similarly, distros for Windows won't work on Linux platforms.

3. JVM

1 Overview

JVM(Java Virtual Machine) is a virtual machine that runs Java bytecode. It is a specification for computing devices. It is a fictional computer that is realized by simulating various computer functions on an actual computer.
It provides a runtime environment that can execute Java bytecodes, and obtain bytecode files by compiling java files into .class files . When the Java virtual machine executes the bytecode, it interprets the bytecode into machine instructions for execution on a specific platform. That's what makes Java "compile once, run anywhere".

Fourth, the connection and difference between JDK, JRE, and JVM

1. Contact

First of all, we have to understand how Java source files are executed?

(1) Use an editor or IDE (Integrated Development Environment) to write Java source files. ie Simple.java.
(2) Programs must be compiled into bytecode files, and javac (Java compiler) compiles source files into Simple.classfiles. (3) Class files can be executed by (Java virtual machine)
on any platform/operating system . (4) Translate the bytecode file into machine code (0,1 binary) that the machine can execute.JVM
JVM

⭕ That is, after we use JDK(call JAVA API) to develop our own JAVA program, we compile our text file into bytecode through JDKthe compiler ( ) in , run these bytecodes on , and parse these bytecodes, System calls that map to the CPU instruction set or OS.javacjavaJAVAJREJAVAJVM

⭕ The execution JVMcannot be done alone . When .classinterpreting .class, you JVMneed to call the class library required for interpretation lib. In the JDKfollowing jredirectory, there are two folders binand lib, here it can be considered that the bininside is the class library required for the work, and the sum is called .JVMlibJVMJVMlibJRE

2. Differences

JRE = JVM + libraries to run Java Application
JDK = JRE + tools to develop Java Application

Guess you like

Origin blog.csdn.net/weixin_52533007/article/details/123473520