1, the Win7 configuration
First download the 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 on 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 configuration is successful.
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.
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.
First step: Download
Download the Linux counterpart version of JDK to/usr/local and unzip it:
$ wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz$ TAR-ZXVF jdk-8u66-linux-x64.tar.gz$ mv jdk1.7.0_79 jdk1.7 # Rename
Get the JDK directory path/usr/local/jdk1.7
Step Two: Configure the Java environment for all users
Log in vim/etc/profile with the root user
Press the INSERT key, and then move to the last line, adding
#configuration Java Development enviroumentexport java_home=/usr/local/jdk1.7export 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.
Step three: Configure the Java environment for the current user
Vim ~/.bash_profile File
Also add the following information:
#configuration Java Development enviroumentexport java_home=/usr/local/jdk1.7export 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.