First, download the Java JDK
The latest version so far is (jdk1.8.0_60) and there are two ways to download it:
1. Using the shell to download, you can download it directly using the following command:
wget--no-check-certificate--no-cookies--header "Cookie:oraclelicense=accept-securebackup-cookie"/HTTP/ Download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz
2. Direct login Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Select the appropriate Java version to download
Second, unzip the downloaded compressed file
Use the following command to compress:
Tar zcvf jdk-8u60-linux-x64.tar.gz, the following folder (JDK1.8.0_60) appears:
Third, configure the Java environment
Use the shell command line to configure the Java environment using the following command
CD ~//User Directory
sudo vi./.BASHRC//use VIM to open. BASHRC, and configure the BASHRC file
(for the use of VI can be see the following tutorial http://c.biancheng.net/cpp/html/2735.html, this configuration only need to make the following several commands, O (the cursor moves to the next line), I (Input), ESC (exit edit mode), SHIFT + ZZ (Save settings and exit))
After you open the. bashrc file, add the following variable at the end of the file
Export java_home= "/home/leesf/program/java/jdk1.8.0_60"//At this time the user name is LEESF, the user according to the user's own user name, to modify (if Zhangsan, then To/home/zhangsan/program/java/jdk1.8.0_60)
Export path= "$PATH: $JAVA _home/bin"
Export jre_home= "$JAVA _home/jre"
Export Classpath= ".: java_home/lib: $JAVA _home/lib"
As follows:
When the settings are complete, press SHIFT + ZZ to exit edit, and then enter source./.BASHRC for Updates .
After the configuration is complete, check to see if the Java environment has been configured, enter the following command:
Java-version can be viewed, the configuration is successful should be as follows:
The entire Java configuration process is complete.
PS: Special attention is paid to directly modify the. bashrc file, and when you modify/etc/profile, the configuration information appears when you enter the Java-version command in the current Shell command window, but when you open another window, you enter Java- Version command, still cannot find the Java information just configured, the difference between the two can be see the following link content: http://forum.ubuntu.org.cn/viewtopic.php?t=246185
I wish you a smooth configuration, there are problems to communicate.
Download and configure the Java environment under Linux