jdk Environment variable configuration includes three items :JAVA_HOME,CLASSPATH ,PATH. The configuration process is as follows :

Right click “ My computer ”( Some systems are called “ computer ”,“ This computer ” wait ), attribute —> Advanced system settings —> environment variable , stay “ System variables ” Do the following under the column :

1. newly build

Variable name :JAVA_HOME

Variable value :jdk Installation path , as :D:\Java\jdk1.6.0_45

2. newly build

Variable name :CLASSPATH 

Variable value :.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar

3. edit

Variable name :Path

Variable value : Add after the original value :;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin

win10 System and win7 The operation mode of the system is different , as follows :

above , Save it .

And then you can use it java -version,java,javac Verify whether the configuration is successful .


linux The configuration of the system can be referred to :