jdk itself contains the operating environment jre,
The old version of the JDK installation package still comes with jre, which needs to be installed together
This version is different from the old version,
The installation package does not contain the jre part,
Therefore, environment variables do not need to configure jre
Removed rt.jar and JDK 9tools.jar
Before classes and resources files are stored in lib/rt.jar
, lib/tools.jar
, lib/dt.jar
and various other internal JAR files are stored in a format more efficient in achieving a specific file lib
directory.
Deletion rt.jar
and similar files can cause problems in the following areas:
The tools.jar package also does not exist, no configuration
JAVA_HOME
C:\Program Files\Java\jdk-11.0.6
CLASSPATH
.;%JAVA_HOME%\bin
. Represents the current path
Newly open the command line:
Run the command java -version
Run the command javac
Can be found, it means that the configuration environment variables are correct
Turn: https://www.iteye.com/blog/uule-2149115
Rt.jar under JRE:
This file is an extremely important file, rt is the abbreviation of runtime , which means the runtime. It is an indispensable file when the java program is running.
It contains packages commonly used by java programmers, such as java.lang, java.util, java.io, java.net, java.applet, etc.
1. By default, rt.jar is placed in the claspath in the loading path of the root classloader.
Do not believe you can remove rt.jar from the classpath
Then use java -verbose XXXX to run a simple class to know the path of the JVM system root loader. Not only rt.jar jre / lib, most of the jars are in this path
2. tools.jar is used when the system is used to compile a class , which is used when javac
javac XXX.java
Is actually running
java -Calsspath=%JAVA_HOME%/lib/tools.jar xx.xxx.Main XXX.java
javac is the encapsulation of the above command, so tools.jar does not need to be added to the classpath
3. dt.jar is a class library about the operating environment, mainly the swing package . It is best to add it when you want to use swing
dt.jar seems to be some kind of swing, and the default JRE of the Eclipse development environment does not include it. It should be useless.
The tools.jar application server is used to compile JSP files, and the application server will load it by itself, no need to set it by yourself.
dt.jar is a class library about the operating environment, mainly swing packages
tools.jar is a class library about some tools
rt.jar contains the basic class library of jdk, that is, the class files of all the classes you see in java doc
About the meaning of path and classpath:
1. The meaning of the path variable is that the system can recognize java and javac commands in any path
2. The meaning of the classpath variable is to tell the JVM where the class to be used or executed is placed , which is convenient for the JVM to load the class file..; Indicates the current path, and tools.jar and dt.jar are the class library path. If you don't need the stuff in Swing, you can not add dt.jar. tools.jar contains the most basic tools, such as javac, which cannot be developed without it.
Compile and run all the classes in toos.jar, which are
sun.tools.java.*;
sun.tools.javac.*;