Installation: official website to download the compressed package to install
1. Download jdk8
Login URL: http: //www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
select the corresponding jdk version download. (Available in the Windows download is complete, the shared folder by file onto Linux)
2. Log in Linux, root user
root account login system centos
3. Establish java installation directory under the usr directory
cd /usr
mkdir java
4. jdk-8u60-linux-x64.tar.gz copied to the java directory
cp /mnt/hgfs/linux/jdk-8u60-linux-x64.tar.gz /usr/java/
The decompression of the current directory jdk
tar -zxvf jdk-8u60-linux-x64.tar.gz
Get folder jdk1.8.0_60
6. installed to establish a link (shortcut) for him to save directory length
(I use this step)
ln -s /usr/java/jdk1.8.0_60/ /usr/jdk
7. editing configuration files, configure the environment variables
vim /etc/profile
Add the following: JAVA_HOME to the actual directory
JAVA_HOME=/usr/java/jdk CLASSPATH=$JAVA_HOME/lib/ PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
8. Perform / etc / profile command
source /etc/profile
9. Reboot the machine
sudo shutdown -r now
10. Review the installation
java -version
The results: I follow the above steps installed jdk 1.7, the pro-test ok
Supplementary Learning:
env: command to view the existing system environment variables
echo $ PATH: PATH environment variable output
Add the environment variable steps:
First: in / etc / profile end of the file add: Export the contents of the environment variable name =
Second: the implementation of source / etc / profile
export mytest=hello:$mytest
source /etc/profile
Third: execution again to add more, but after the restart after the entry into force or normal environment variables
Fourth: ssh windows closed, reopened