Here are three concepts to start with:
JVM----JAVA Virtual machine
Java Virtual machine: Provides the same interface to bytecode, providing different interfaces to the operating system to accommodate each OS
JRE----JAVA Runtime Environment
Java Run-time environment
JDK----Java SE Development Kit
Java Standard Edition Development Kit
This is the three basic concept of learning Java, their relationship is as follows
JDK (Development Essentials) |
-|-----JAVA Class Library |
|
|
|
|-----java Compiler |
|
|
|
|-----JRE (running Java must be installed) |
Jvm |
|
|
|
Class Loader |
-| |
|
|
BYTE-code Checker |
|---Other environment support for running Java programs |
|
|
Base Class Library |
_| |
|
|
|
|
, run the Java program to install the corresponding JRE, if need to develop the need to JKD, simple JVM is meaningless (there is no official download)
Java from code to run:
Java source files (. java files)----->java compiler (compiled with JAVAC)-----> Bytecode files (. class files)---|
Machine code for a specific platform (OS can run) <--Java Virtual machine run (execute with Java interpretation) <---|
The Java compiler generates byte codes that are independent of each platform, they are not targeted at any platform, they target only the JVM, and the JVM is different on different platforms, but they all provide the same interface to handle bytecode, which simultaneously produces different interfaces for different platforms (linux/ Win) The JVM can be said to be a converter.
Another jar package:
We will also encounter. Jar packages. Jar (Java Archive file translated as Java archive). The straightforward point is a zip package that compresses. class, but because he contains a file inside
Meta-inf/manifest. MF (when generating the jar package), so that there is a certain structure between the. class files inside. Our program can refer directly to these jar packages (which are a bit like DLL files in C #), or run the jar package directly
here to note
(1). The name of the. java file is random, but if there is a public class in the Java file, the. java file must have the same name as the class name, so there can be at most one public class.
(2) 1, the name of the case is sensitive (also remember that all the keywords are lowercase).
2, the default path (JDK default path) is the program files in the middle of the space, it is best to choose a path without spaces (and do not have Chinese characters, so as not to make the mistake of inexplicable)
Environment variables:
Why set environment variables?
After we have installed the JDK, if not set: when we typed in Java or JAVAC commands: Java, Javac is not an internal or external command, and is not a program or batch file that can be run. This is because, although we have already installed the JDK on the computer, and the path of the JDK Wild has both Java and Javac commands, but the computer does not know where to look for these two commands (in other words the computer does not know that they have these two features), so we need to set a guide (path), Tell the OS to go here and see.
Path:java directory for compiling and running tools
Classpath:java call requires the address where the tool class resides
Java_home the Java installation directory's public name (which is the JDK's installation directory)
Memory recovery mechanism for Java (GC)
This is the same as C #, here is not more than repeat. Just simply mention the
(1) Not timely recovery of memory---> can be used in the amount of memory space will be smaller---> recovery frequency will become higher---> Performance degradation
(2) Java is never forced to reclaim memory, only JVM recycling is recommended.
Java Runtime Environment and operating mechanism