Objective:
This tutorial is based on JDK 1.8, but this tutorial is for versions such as jdk1.7.
Tutorial Body: 1.1. Login to Oracle website Download jdk1.8 installation package (GZ end)
Here you can use "wget +" to implement the download.
Q: do I need a cookie to download the JDK?
A : students are advised to click the download directly in the browser and then copy the download link in the download task. )
1.2. Extract the installation package to the specified directory (e.g./usr/local/soft/)
Tar -XZVF JDK installation package
1.3. Configure the environment variables.
( add the path to the JDK and JRE in/etc/profile and add to path)
1.3.1. Open File/etc/profile:
Vim/etc/profile
1.3.2. Add the following:
( please fill in your actual JDK path, the following example of the JDK path is the/USR/LOCAL/SOFT/JDK folder name )
Export JAVA_HOME=/USR/LOCAL/SOFT/JDK folder name Export JRE_HOME=/USR/LOCAL/SOFT/JDK folder name/jreexport path= $PATH: $JAVA _home/ Bin: $JRE _home/bin
1.3.3. Press ESC, enter: Wq Save to exit.
1.4. Adding Java to the bin
( please fill in your actual JDK path, the following example of the JDK path is the/USR/LOCAL/SOFT/JDK folder name )
Update-alternatives--install/usr/bin/java java/usr/lcoal/soft/jdk folder name 300
1.5. Add Javac to Bin
( please fill in your actual javac path, the following example of the JDK path is the/USR/LOCAL/SOFT/JDK folder name/bin/javac)
Update-alternatives--install/usr/bin/javac javac/usr/lcoal/soft/jdk folder name/bin/javac 300
This blog address:http://www.cnblogs.com/toulanboy/ 1.6. Select the JDK version
( recommended, as it is possible to store multiple JDK versions on the current machine )
1.6.1. Enter the following command
Update-alternatives--config Java
1.6.2. Enter a number to select the version we are installing.
1.7. Refresh the system environment variables
Source/etc/profile
1.8. Verification
(normal output is correct)
Java-versionjavajavac
This blog address:http://www.cnblogs.com/toulanboy/ Reference: "Kafka Introduction and Practice"
Linux Installation configuration Java Environment Tutorial