The JDK environment variable configuration is the first problem for Java developers to encounter. Below is a description of the configuration of the JDK environment variables under the Win7 platform and Linux
1, the Win7 configuration
Start by downloading a JDK that complies with the OS version, such as the latest JDK8
Download link http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html;
Of course, the general developers will not be the latest JDK, now the mainstream choice is jdk6 and jdk7, of course, more and more developers switch to JDK8 platform.
After downloading, install all the way, the native JDK installation path is C:\Program files\java\jdk1.7.0_79
Then follow the steps below, computer--"Properties--" Advanced system settings--"Environment variables
In the environment variable of XXX (XXX stands for your computer name) new Java_home (this name is custom, but Universal is this), enter the value
Show.
The second step is to find the path in the system variable below, edit it, and add it to the last side.
%java_home%\bin;%java_home%\jre\bin
Then in the new variable name classpath, the input value is.; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar, pay attention to that point!!!
Click OK. WinDOS key +r, input cmd
Then enter the command java-version if you can see the Java-related version information, the Java environment variable is configured successfully,
Configuration of 2.linux Environment variables
Both Linux and Win7 are multi-user operating systems, so the location of the configuration environment variables illustrates the scope of this environment variable to work.
As above Win7 I configured to Bai user, then only when Bai user log in to be able to use the Java environment. Other users will not be able to use, of course, if your configuration is on the system variables, then all users of this computer can use this environment. With this concept in place, configuring environment variables on Linux is straightforward.
0) Download the Linux counterpart version of JDK to/usr/local,jdk-7u79-linux-x64.tar.gz and then tar zxvf jdk-7u79-linux-x64.tar.gz to get the JDK directory path/usr/local/ jdk1.7.0_79
MV jdk1.7.0_79 jdk1.7 Rename
1) Configure the Java environment for all users.
Log in with Rooty user Vim/etc/profile
Press the INSERT key, and then move to the last line, adding
#configuration Java Development enviroument
Export java_home=/usr/local/jdk1.7
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Then press ESC, enter Wq, exit and enter Java-version if you can see the corresponding version information, the Java environment variable configuration is successful,
2) Configure the Java environment for the current user
Vim ~/.bash_profile File
Also add the following information
#configuration Java Development enviroument
Export java_home=/usr/local/jdk1.7
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
You can log in again, which is the two common methods. Record the memo.
Java Development Environment configuration under Win7 and Linux