Directory structure:
contents Structure [-]
- What is JDK,JRE,JVM
- Why do I have two JRE when I install the JDK?
- Dedicated JRE
- Common JRE
- Comparison of shared JRE and dedicated JRE
- The cross-platform features of Java
- The role of each JDK file
- Reference articles
1, what is JDK,JRE,JVM.
Jdk:java development Toolskit, contains Java development tools and JRE.
Jre:java runtime enviroment, which contains the Java Runtime environment and the JVM.
Jvm:java virtual Machine,java VM, used to ensure the cross-platform of Java.
Diagram of the three:
2, why does installing the JDK show two JRE
When we installed the JDK, we had two JRE, a JRE outside the JDK, and a JRE inside the JDK, the so-called shared JRE and dedicated JRE.
2.1 Dedicated JRE
The dedicated JRE is located inside the JDK and is designed to run the tools contained in the JDK. The dedicated JRE does not have a registry setting, usually C:\Program Files\jdk1.7.0\jre located in ().
When configuring the JDK, we configured the environment variable path and classpath, where the Tools.jar package (the Java-developed base package) was configured in Classpath. When we change the Tools.jar package to another name, the following error occurs:
The reason for this error is that we changed the name of the Tools.jar, and the Java program did not find the Tools.jar package during the run, so we reported an error. Then look at the tools in the JDK installation directory, almost all of them are bytecode (class files), that is, to use the tools attached to the JDK to develop Java programs, so you need to attach a set of JRE to run.
2.2 Common JRE
The public JRE can be used by other Java applications and is included outside the JDK (typically located in C:\Program files\java\jre1.7.0). The public JRE is registered to the Windows registry (located in Hkey_local_machine\software\javasoft).
2.3 Public JRE vs. dedicated JRE
When we just need to run Java programs that others have already developed, it's time to use a common JRE. But if we need to develop Java programs, then we have to install JDK,JDK with dedicated JRE and development tools that require a dedicated JRE to be used, and that the dedicated JRE is prepared for us to develop Java programs. There is a difference between the two JRE files, so they cannot be exchanged casually.
3,java features of cross-platform
From the picture we have, the Java language has cross-platform features, but the JVM does not have cross-platform.
When we compile a Java file with the Javac command, we generate a bytecode file that the JVM can recognize, and this process is not implemented in the JRE. When we run the class file with the Java command, this process is implemented by invoking the JVM in the JRE. In other words, the JRE does not have compile functionality.
4,JDK the role of each file in the installation directory
Bin-the executable file for the development tools contained in the JDK, the PATH environment variable should contain an entry to this directory. This is what the book says: Some command-line tools, including the Java compiler's startup commands. The function of all executables under the bin directory can refer to the different EXE files in the Jdk/bin directory for the purpose of the document
DB-The JDK has built a derby database since 1.6, a purely Java-implemented memory database that belongs to an Apache open source project. Implemented in Java, so it can be run on any platform, and another feature is a small size, no installation, just a few small jar packages to run.
Include--header file for Java and JVM interaction;
Lib--Common class library
JRE-Java Runtime Environment
SRC--A compressed file of some source code
JAVAFX-SRC--Source compression files for graphics and media packs
5, reference article
Use of different EXE files under the 1,jdk/bin directory
2,jdk each folder function.
3, why there are two JRE files when installing the JDK
The relationship between Jdk,jre and JVM in 4,java
"Java learning" JDK, JRE, JVM relationships