Related terms and definitions
JDK (Java Development Kit) Sun Inc. free Software Development Kit for Java Developers (Sdk,soft Development Kit)
JRE (Java runtime Environment,java running environment)
JVM (Java vitrual machine) Java virtual machines
JDK contains JRE JRE contains JVM
The relationship between three people
The JVM is included in the JRE, the JRE is included in the JDK, the JRE is the running environment, and the JDK is the development environment. The Java compiler compiles the Java language into bytecode, which is a virtual machine-oriented code, which is the instruction set of the virtual machine, and the virtual machine is interpreted as a machine code for different platforms, depending on the platform and different versions.
Jvm:java virtual machines, which are platform-related, we say that the JDK versions of each platform are different. The point is that the JVM version is different.
The JVM is what we often call Java virtual machines, the most central part of the entire Java implementation across platforms, all Java programs (. java files) are first compiled into a. class file, which can be executed on a virtual machine, which means that class does not correspond directly to the machine's operating system, but instead interacts with the operating system indirectly by the virtual machine, which interprets the program to the local system for execution.
The JVM is the foundation of the Java platform, which, like the actual machine, has its own set of instructions and operates in different memory areas at runtime. By abstracting the operating system and CPU structure, the JVM provides a platform-independent code execution method that is independent of the special implementation method, host hardware, and host operating system. But in some small ways, the implementation of the JVM is not the same, such as garbage collection algorithm, thread scheduling algorithm (perhaps different OS have different implementations).
The main task of the JVM is to explain its own set of instructions (that is, bytecode) to the CPU's instruction set or OS system calls to protect the user from malicious program harassment. The JVM does not care about the upper Java source files, it only focuses on the class file generated by the source file. The composition of the class file includes the JVM instruction set, the symbol table, and some subsidy information.
The Jre:java runtime environment contains the JVM and Java Runtime support class libraries and files.
The JDK contains Java compilers and jre,jre that contain JVM and Java run support files.
2. JRE-Java Runtime Environment
The JRE refers to the Java Runtime environment. The JVM cannot be executed as a class, because the JVM needs to invoke the class library lib that is needed to interpret the classes. In the JDK installation directory you can find the JRE directory, there are two folders Bin and Lib, here you can think that the bin is Jvm,lib is the JVM to work the class library, and the JVM and Lib are called the JRE. So, after you've finished compiling the Java program into. class, you can package the. class file with the JRE and send it to your friends so that your friends can run your program. (There are java.exe running. Class in the JRE)
The JRE is a larger system released by Sun, and it has a JVM inside it. The JRE is related to the specific CPU structure and operating system, and we see different versions when we download the JRE from Sun. There are also APIs (such as AWT, swing, and so on) that make up the JRE together with the JVM. The JRE is essential for running Java programs.
JRE (Java runtimeenvironment) is essential for running Java programs (unless compiled into an. exe executable with some other compiled environment ...). ), the JRE is like a PC, and our WIN32 application requires the operating system to run it, and the Java program we write must also have the JRE to run.
there is a JVM in the JRE, the JRE is related to the specific CPU structure and operating system, we see different versions when we download the JRE from Sun, and there are some APIs (such as AWT, swing, etc.) that form the JRE with the JVM, and the JRE is necessary to run a Java program.
3. JDK--Java Development Kit
The JDK is the Java SDK, and basically everyone who learns Java will first have a JDK on the machine, which part does he include? Let's take a look at the JDK installation directory. Under the directory there are six folders, a SRC class library source code compression package, and several other declaration files. One of the four folders that really worked when running Java was the following: Bin, include, Lib, JRE. Now we can see a relationship where the JDK contains the JRE, and the JRE contains the JVM.
Bin: The main thing is the compiler (Javac.exe)
Include:java header files for interaction with the JVM
lib: Class library
Jre:java Operating Environment
(Note: The bin, Lib folder and the bin in the JRE, Lib is different) in general, the JDK is used for the development of Java programs, and the JRE is only to run class and not compiled functionality.
other Ides such as Eclipse, idea, and so on have their own compilers instead of the JDK bin directory, so you'll find them only asking you to check the JRE path when installing.
two or three people contact
Java's iconic slogan, "Write Once, run anywhere (once written, running everywhere)" is built on the JRE. How is it achieved? Is the addition of a virtual layer--jre between the Java application and the operating system.
The program source code is not directly compiled, linked to machine code, but first converted to bytecode (bytecode) This special intermediate form, bytecode conversion to machine code or system call. The former is a traditional compiling method, and the generated machine code is inevitably related to the special operating system and the special machine structure.
The Java program's bytecode files can be placed on any of the installed JRE of the computer to run, and then by the different JRE into the corresponding machine code, which enables the Java program portability. In this way, programmers do not have to care about the specific environment in which the program runs, but can concentrate on writing software. The idea of layered abstraction and hidden detail is visible in computer science, such as the design of machine organization structure and the realization of network protocol. Niklaus Wirth, the inventor of the Pascal language, predictably pointed out that there should be a portable language in which the intermediate code generated could run on an imaginary machine (a hypothetical machines).
the Java Virtual machine (Java VM or JVM) is one such machine that simulates the structure of the actual processor and interprets the bytecode. How can one say that it is the JRE, and then it becomes the JVM, and are the two different names? The answer is in the negative.
The JRE is like a PC, and our WIN32 application requires the operating system to run it, and the Java program we write must also have the JRE to run.
to run applets, the client must have a JRE installed, or "runtime", which is easy to understand, like so-called "plug-ins", to develop Java application \web applications, you must install the appropriate JVM+JDK on the server side (when developing Java Web applications, The client does not need to install any JVM)
If you use Java to develop your application, you need to install JRE+JDK, which is J2SE.
If the applet is run on the client, the client browser must have a Java JVM embedded, and if not, it needs to be installed, that is, the JRE is created on the client (runtime, including the JVM), and the client does not need to be developed, so the JDK is not necessary to install it.
different versions of applets may not work properly under different JVMs, and Microsoft JVM is just the "low version" of the Sun JVM, and Microsoft simply removes the JVM from Windows xp/2003.
Java Course Series notes (1)