Linux installation JDK1.8 steps
1、 Check whether CentOS has its own openJDK. It is not recommended to use the built-in openJDK, so uninstall it first.
Enter the command "java -version", the following figure shows that it comes with openJDK
2、 Uninstall the built-in openJDK method:
Query files with java first: enter the command "rpm -qa|grep java" to delete java files other than .norach
Execute the delete command: "rpm -e -nodeps java-1.8.0-openjdk-headless"
Execute the delete command: "rpm -e -nodeps java-1.8.0-openjdk" (you can use the tab key to fill in automatically)
After the uninstallation is complete, start to download and install jdk.
3、 Download JDK
Select the corresponding jdk according to the number of bits in the system, and check the number of bits command "getconf LONG_BIT"
download link:
64 Bit: Link: https://pan.baidu.com/s/1tccc9tlwhCScmZp90urRGw Extraction code: wmvi
32 Bit: https://pan.baidu.com/s/1n3jtj0yaa091HZ0ZBYyJGA Extraction code: x25w
4、 Upload JDK
Use the rz command to upload, if there is no rz command, first use yum -y install lrzsz
to install
5、 Unzip the JDK
Execute the command "tar -zxvf jdk-8u161-linux-x64.tar.gz"
6、 Configure environment variables
The environment variables of the windows operating system are configured through tools. On linux, the environment variables are stored in the profile file, open the file, and vim can modify it.
(You can also download and modify with sz and upload with rz, so I think editing is more convenient. Personal operation, unprofessional, do not spray!)
The configuration is as follows:
{ JAVA_HOME}/jre export CLASS_PATH=.:JAVAHOME/lib:{JRE_HOME}/lib:CLASSPATH export JAVA_PATH=JAVAHOME/bin:{JRE_HOME}/bin export PATH=PATH:{JAVA_PATH}
After the configuration is complete, execute the command "source /etc/profile" to make the file effective
7、 Verify that the installation is successful
Execute the command "java -version", the following installation is successful, consistent with windows
Recommended Posts