eclipse 4.2.0 installation how to change the jdk environment variable (name = Eclipse Platform id = org.eclipse.platform version = 4.2.0)

      jdk1.7 

1. Right-click Computer-Properties-Advanced System Settings-Advanced-Environment Variables, and the "Environment Variables" dialog box will pop up.

The main reason is to change the following environment variables, not the Administrator above. (Otherwise, other users have to match their own)

Add JAVA_HOME to indicate the JDK installation path, such as C: \ Program Files \ Java \ jdk1.7.0 ***, including lib, bin, jre and other folders under this path 
2. Add in the Path variable:

Design:% JAVA_HOME% \ bin;% JAVA_HOME% \ jre \ bin;    

ps: The semicolon is mainly used to separate the path of jdk and the path of other system programs and applications. 

3. Add the CLASSPATH variable to the (class or lib) path of the java loading class,

(In this way, when the java virtual machine loads the class file, it only knows where to find it. Only the class is in the classpath, the java command can recognize it)

Set to:.;% JAVA_HOME% \ lib;% JAVA_HOME% \ lib \ tools.jar

 (To add. Represents the current path, the current path means the place where the class file of the program you compile and run now) 





Test whether the configuration is successful: in DOS, after entering the command java enter, various commands of java should appear;
          javac will also appear the relevant compiled commands;
  java -version The jdk version number appears, ps: Note that java and javac are commands (verbs), followed by -version can be understood as an object, there are spaces in the middle, remember! ! !
Special attention:
In cmd, enter the
 set java_home command to see the jdk installation directory;
   set path can see the value of the path variable, the execution path of various programs
set classpath can see the class loading path


◆ The end of the environment variable value can be added Semicolon or not added, used between different values; (remember: semicolon is used to separate, as long as it is two different paths need to be separated by semicolon)

◆ CLASSPATH variable value. The current directory, in addition The java_home variable is referenced by path and classpath as a whole. The advantage is that after reinstalling the jdk in the future, you only need to change the value of java_home
Published 9 original articles · praised 1 · visits 851

Guess you like

Origin blog.csdn.net/weixin_36466834/article/details/53456108