Set the path, CLASSPATH, JAVA_HOME, and classpathjava_home for JAVA environment variables.
I hope you can give me some suggestions on some mistakes made by beginners in JAVA.
If it can help the same confused students, it is a very promising thing.
When I first learned JAVA, I will certainly encounter the setting of these three environment variables. I often don't know why,
I have followed the instructions but I don't know why. Here I will give some summary.
First, what are environment variables?
Environment variables are some parameters used in the operating system to specify the operating system environment..
Is the variable we can set in the operating system. What are the functions of these variables? They are related to specific variable names.
Next, we will introduce the three environment variables we will set.
JAVA_HOME: This is an environment variable that We append.
Set it to the JDK installation path (for example, C: \ Program Files \ Java \ jdk1.7.0 _ 79). This path contains lib, bin, jre, and other folders.
The purpose is to write % JAVA_HOME % when we need the java path, instead of entering a long string of addresses.
Path: the default Path for running a program that is not specified in the operating system.
Append an existing Path"; % JAVA_HOME % \ bin". % JAVA_HOME % refers to the previously specified JAVA_HOME variable.
When we executeJavac HelloWorld. javaYou do not need to specify the location of the command javac,
Because the operating system will automatically go to"C: \ Program Files \ Java \ jdk1.7.0 _ 79 \ bin"SearchJavac.exeAnd then run.
CLASSPATH: the path for loading classes in the Java Runtime Environment. Only classes in classpath can be identified and loaded, and set .; % JAVA_HOME % \ lib (note the dot (.), point number indicates the current path ).
To be continued.