1 Download jdk, address: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Download the historical version: Open the page and pull it to the bottom.
Choose the version you want to download. What I downloaded here is jdk-7u80-linux-x64.rpm
2 Delete the system's own jdk
Check whether openjdk is installed using rpm -qa | grep jdk
sudo yum remove xxx (name found above)
3 Modify the installation package permissions
sudo chmod 777 jdk-7u80-linux-x64.rpm
4 Installation
sudo rpm -ivh jdk-7u80-linux-x64.rpm (installed in /usr/java by default)
5 Configure jdk environment variables
vim /etc/profile
Add at the end
export JAVA_HOME=/usr/java/jdk1.7.0_80export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/bin
Then save
Then execute source /etc/profile to make the configuration take effect
Then execute javac and appear the following figure means that the configuration is successful
Summarize
The above is the tutorial on installing and configuring jdk in centos introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!