I believe many Java friends have installed the JDK in the Windows operating system, there is no detailed description of the JDK.
Installing the JDK under Windows Reference: JDK Installation and configuration
1. Download JDK
We can go to the official website (http://www.oracle.com/) to download the Linux version of the JDK, here I use the version 1.6 jdk(http://pan.baidu.com/s/1hscxEvy )
2. Installation
Because I was installing Linux (Red Hat Enterprise Linux 5) in a VMware10.0 virtual machine, I placed the JDK installation file in my virtual machine's shared directory ("D:\\share").
(1) We open the Linux terminal and copy the JDK files in the shared directory ("/mnt/hgfs/share/") to the "/usr/java/" directory before installing:
[Email protected] ~]# cd/mnt/hgfs/share///Enter a shared directory[Email protected] share]# ls-l//view files within a directoryTotal70117-rwxrwxrwx1Root root71799552 Geneva- A One: -Jdk-6u45-linux-i586.bin//This is the JDK file .[Email protected] share]# mkdir/usr/java///Create a new Java directory under the/usr directory[email protected] share]# CP jdk-6u45-linux-i586.bin/usr/java///Copy the JDK files into the/usr/java/directory[[email protected] Share]#[[email protected] share]# CD/usr/java///go to the Java directory[Email protected] java]# ls-l//view files within a directoryTotal70196-rwxr-xr-x1Root root71799552 Geneva- A One: +Jdk-6u45-linux-i586.bin//The JDK files have been copied to the Java directory[Email protected] java]#
(2) Execute./jdk-6u45-linux-i586.bin to install and wait for installation to finish
[[email protected] java]#./jdk-6u45-linux-i586.bin // install JDK
(3) After installation, enter the command "Ls-l" to view
[[email protected] java]# ls-70200drwxr8 root root 40962013 -jdk1.6.0_45 //// Remember this directory name (jdk1.6.0_45) and use it when configuring environment variables 1 71799552 -£jdk-6u45-linux-
3. Configure Environment variables
Add the following environment variable at the end of the/etc/profile file: (My JDK directory above is jdk1.6.0_45, so this is the Java_home)
Export JAVA_HOME=/USR/JAVA/JDK1. 6 . 0_45export PATH= $JAVA _home/bin: $PATHexport CLASSPATH=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/ Tools.jar
(1) Use VI to open the profile file, and then add the above environment variables at the end of the file to save the exit:
/etc/profile // Open after editing with VI
(2) Let/etc/profile file changes immediately after the effective, there are two ways:
Method 1:
To make the/etc/profile file effective immediately after modification, you can use the following command:
# . /etc/profile
Attention:. There are spaces between the/etc/profile and the
Method 2:
To make the/etc/profile file effective immediately after modification, you can use the following command:
# Source/etc/profile
Note: You can try restarting the system if it still does not take effect
4. Testing
We enter Java-version to view the version of the JDK, if it is 1.6.0_45, the configuration is successful, because I installed this version, if not the configuration failed, should check which link above the wrong, or restart the system to try.
[Email protected] java]# java-"1.6.0_45"1.6. 0_45- 20.45-
To install the JDK in Linux