Wednesday, June 28, 2017

JAVA_HOME、PATH、CLASSPATH

JAVA_HOME
指的是你JDK安装的位置,一般默认安装在C盘,如 C:\Program Files\Java\jdk1.8.0_91

PATH
将程序路径包含在PATH当中后,在命令行窗口就可以直接键入它的名字了,而不再需要键入它的全路径,比如上面代码中我用的到javac和java两个命令。
一般的 PATH=%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;%PATH%;
也就是在原来的PATH路径上添加JDK目录下的bin目录和jre目录的bin.

CLASSPATH CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
一看就是指向jar包路径。
需要注意的是前面的 . 代表当前目录。

@reference_1_csdn

JAVA_HOME= C:\Program Files\Java\jdk1.6.0_10
Path= %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
CLASSPATH= .;%JAVA_HOME%\lib;

@reference_2_zhidao.baidu

The bootstrap class loader loads the core Java libraries located in the <JAVA_HOME>/jre/lib directory. This class loader, which is part of the core JVM, is written in native code.
The extensions class loader loads the code in the extensions directories (<JAVA_HOME>/jre/lib/ext, or any other directory specified by the java.ext.dirs system property). It is implemented by the sun.misc.Launcher$ExtClassLoader class.
The system class loader loads code found on java.class.path, which maps to the CLASSPATH environment variable. This is implemented by the sun.misc.Launcher$AppClassLoader class.

@reference_3_wikipedia

No comments:

Post a Comment