Home  >  Article  >  Java  >  Detailed introduction to JDK, JVM and JRE in java environment

Detailed introduction to JDK, JVM and JRE in java environment

高洛峰
高洛峰Original
2017-01-23 16:05:241636browse

JDK, JVM, JRE in the java environment

Recently, I have underestimated Android, and a bunch of concepts JDK, JVM, JRE, SDK, NDK, and ADT have come to mind. After a while, JDK, JVM, and JRE are things for the Java environment, while SDK, NDK, and ADT are things used for Android development. Let’s differentiate between JDK, JVM, and JRE.

Tips: After downloading java on mac, where is it? See the picture below

Detailed introduction to JDK, JVM and JRE in java environment

First let’s talk about JDK

 JDK (Java Development Kit) is a software development kit (SDK) for the Java language.

JDK is the core of the entire JAVA, including the Java Runtime Environment (Java Runtime Envirnment), a bunch of Java tools (javac/java/jdb, etc.) and the basic Java class library (i.e. Java API).

There are the following three versions:

SE (J2SE), standard edition, standard edition, is the version we usually use. Starting from JDK 5.0, it was renamed Java SE.

EE (J2EE), enterprise edition, enterprise edition, uses this JDK to develop J2EE applications. Starting from JDK 5.0, it was renamed Java EE.

ME (J2ME), micro edition, is mainly used for java applications on mobile devices and embedded devices. Starting from JDK 5.0, it was renamed Java ME.

Let’s talk about JRE

JRE is the abbreviation of Java Runtime Environment. Java Runtime Environment (including Java Plug-in) is a product of Sun and consists of two parts: Java Runtime Environment and Java Plug-in. in. Java Runtime Environment (JRE) is a Java platform on which applications can be run, tested and delivered. It includes Java virtual machine (jvm), Java core class library and supporting files. It does not include development tools (JDK) - compilers, debuggers and other tools. JRE requires auxiliary software--the Java Plug-in--in order to run applets in the browser.

Without JDK, Java programs cannot be compiled, but programs can be run on systems with a JRE environment. So when you just need to run a Java program or Applet, download and install the JRE. If you want to develop Java software by yourself, please download JDK.

Finally let’s learn about JVM

JVM is Java Virtual Machine. JVM is a specification for computing devices. It is a fictitious computer. It is achieved by simulating various computer functions on an actual computer.
A very important feature of the Java language is its independence from the platform. The use of Java virtual machine is the key to achieving this feature. If a general high-level language wants to run on different platforms, it must at least be compiled into different target codes. After the introduction of the Java language virtual machine, the Java language does not need to be recompiled when running on different platforms. The Java language uses the Java virtual machine to shield information related to specific platforms, so that the Java language compiler only needs to generate the target code (bytecode) that runs on the Java virtual machine, and it can run on multiple platforms without modification. . When the Java virtual machine executes bytecode, it interprets the bytecode into machine instructions for execution on the specific platform. This is why Java can "compile once, run anywhere".

This is the relationship diagram between the three:

Detailed introduction to JDK, JVM and JRE in java environment

The actual situation of our development is: we use JDK (calling JAVA API) to develop a After our own JAVA program, our text java files are compiled into JAVA bytecodes through the compiler (javac) in the JDK, and these JAVA bytecodes are run on the JRE. The JVM parses these bytecodes and maps them to CPU instructions. Set or OS system call.

JVM (Java Virtual Machine), that is, Java Virtual Machine

JVM shields information related to the specific operating system platform, so that Java programs only need to generate target code that runs on the Java virtual machine (bytecode), it can run without modification on multiple platforms. When the JVM executes bytecode, it actually ultimately interprets the bytecode into machine instructions for execution on the specific platform. Compiling a virtual machine's instruction set is very similar to compiling a microprocessor's instruction set.

JVM is the foundation of Java language cross-platform (the "platform" here refers to different operating systems). If you want to run Java programs on different operating systems, you need to install the corresponding software on different operating systems. JVM. Therefore, JVM has Windows version, MAC version, Linux version, etc.

JRE (Java Runtime Environment), that is, Java runtime environment

JRE includes the Java virtual machine and the core class libraries required by Java programs. If you want to run a developed Java program, you only need to install JRE on your computer.

Summary: JRE=JVM+Java class library

JDK (Java Development Kit), that is, Java Development Kit

JDK is provided for Java developers, including JRE and some Java development tools, such as compilation tools (javac.exe), packaging tools (jar.exe), etc. So after installing JDK, there is no need to install JRE. As learners of Java language, we must install JDK. Without JDK, we have no way to compile and run Java code. This is why almost all Java introductory tutorials recommend that we install JDK.

Summary: JDK=JRE+Java Development Tools

Thank you for reading, I hope it can help everyone, thank you for your support of this site!

For more detailed introductions to JDK, JVM, and JRE in the Java environment, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn