The source code of Java is a plain text file of *.java and can be written using any text editor, but this source code cannot be executed. This task of executing the source code requires JDK and JRE.
JDK is a development package for the Java language, which can compile files ending with *.java into executable Java programs. Then, with an executable Java program, a JVM is needed to run this Java program. The Java running environment, that is, JRE, contains JVM. JVM is Java's virtual machine. Finally, JRE is included in the JDK. With such a logical basis, let’s understand JRE and JDK respectively.
Let's take a look at JRE first. JRE is the abbreviation of Java Runtime Environment in English, which refers to the Java running environment. It is for users of Java programs, not developers. It is a collection of environments necessary to run Java programs, including JVM standards, implementations and Java core class libraries. It can only complete Java operation, but cannot compile or debug Java. JRE's status is like a PC. The Windows 32 or Windows 64 applications we write require the operating system to help us run. Similarly, the Java program we write also requires JRE to run. Only when a computer has JRE installed can the Java application be run correctly. JRE has a separate version. If a user only needs to run Java programs, he only needs to install a JRE. And this set of JRE must appear in the C:/Program Files/Java directory.
Let's look at JDK again. JDK is the abbreviation of the English Java Development Kit and is a software development toolkit for the Java language. It is a Java suite for Java developers. The basic components included in JDK include: compiler, jar packaging tool, Javadoc document generator, Debug debugger, header file generator, disassembler, monitoring tool, etc. The JDK contains a completed JRE. So, if you install JDK, you don't have to install JRE again. If your computer has both JDK and JRE installed, you will find that your computer has two sets of JRE, one is located in /jre and the other is located in the C:/Program Files/Java/jre1.5.0_15 directory. The latter set has less Server-side Java virtual machine than the previous set, but you can just copy the previous set of Server-side Java virtual machine. And when installing the JDK, you can choose whether to install this JRE located in the C:/Program Files/Java directory.
Finally, let's talk about JVM by the way. JVM is a Java virtual machine, the abbreviation of Java Virtual Machine in English. It is the most core part of the entire Java implementation cross-platform. All Java programs will be compiled into .class class files first, which can be executed on a virtual machine. In other words, the class does not directly correspond to the machine's operating system, but interacts indirectly with the operating system through the virtual machine, and the virtual machine interprets the program to the local system for execution.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.