You get a text Java environment variables
Remember new to Java, the first thing is with the environment variable, as a beginner, only know how to fit the environment variable, plus a variety of IDE so that we can facilitate the development, while ignoring the essence of things, only know not why, with the continuous in-depth, and finally understand the meaning of the Java environment variables are represented.
First we look at the Java environment variables, for example in my own
- JAVA_HOME:C:\Program Files\Java\jdk1.8.0_144
- PATH:%JAVA_HOME%\bin
- The CLASSPATH :. (A lower English
.
and some version is.;
also followed this.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
)
In the Linux environment variables
Let's take to solve the first problem, why do we have to configure the environment variables?
Speaking configuration environment variable, if we can not not configured to run java program yet? The answer is as long as the display jdk installation (or jre) We can run our .class files, but this time wanted to run successfully at run time, how should the following manner:
And with a good environment variable to compile and run the process as follows:
We can see the environment variable role is to help us eliminating the java、javac
absolute path in front of the command, but its function can be used directly.
We take a look at the built-in Windows environment variables:
We are concerned about them%SystemRoot%\system32
The %SystemRoot%\system32
folder is the decentralization of the Windows system files, such as cmd.exe、calc.exe、dxdiag.exe、msconfig.exe
, etc., enter the file name can be run directly in the cmd between these files, but if the environment variable %SystemRoot%\system32
after deleted, it can not run these programs.
Now I would like to environment variables we should have a deep understanding of: with a good environment variable, when we run the program, the system will automatically find programs that we want to perform in the environment variable corresponding directory, thus eliminating the need for command a long list of absolute path before.
Finally, we explore in detail about the specific role of java environment variables:
JAVA_HOME:C:\Program Files\Java\jdk1.8.0_144
JAVA_HOME is to specify the installation directory of jdk
PATH:%JAVA_HOME%\bin
PATH is the directory where the command specified JAVA
The CLASSPATH :. (A lower English
.
and some version is.;
also followed this.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
)CLASSPATH position specified bytecode to be executed (.class) file
By a simple example to understand CLASSPATH
while Hello.class not perform filejava Hello.class
directory command, but .class file specified by the parameter can then run any position -classpath Hello.class file.