Install jdk1.7 using CentOS7 under linux

  • 2020-11-26 19:04:04
  • OfStack

Step 1: Uninstall the original or native jdk

Some linux systems come with OPENJDK, so we'd better delete the original jdk before installing it.

(1) java -version Command to view current jdk version information

java -version

(2) rpm -qa | grep java The command queries the java installed by the operating system itself

rpm -qa | grep java

Step 2 Download and install jdk

Most of the information found on the Internet, jdk download path is invalid, so we suggest you go to Baidu to find, or download on the official website. Much of the information here is downloaded using the curl+ address method, but we need to be clear about the address path. Another option is to download the installation package directly, drop it into the linux server, and unzip it.

Website address: jdk download address

Download address: jdk Download address

Sample version of this article: jdk-7u79-linux-x64.tar.gz

Place the downloaded ftp tool in the specified directory of linux, for example: /usr/local/jdk7.

There are no jdk paths to create.

(1) Enter /usr/local directory

cd /usr/local1

(2) Create jdk7 directory

mkdir jdk7

(3) View files under /usr/local/jdk7 directory

ll /usr/local/jdk7 or ls /usr/local/jdk71

(4) Unzip the jdk package

tar -zxvf jdk-7u79-linux-x64.tar.gz 1

(5) If you need to move the path of jdk installation file


mv /usr/local/jdk7/jdk1.7.0_79 /usr/local/java/jdk1.7.0_791

Set the jdk environment variable

(1) After completion of installation, the environment variable under 1 should be configured to edit /etc/profile file


vi /etc/profile

(2) Add the following configuration at the end of the file


export JAVA_HOME=/usr/local/jdk7/jdk1.7.0_79 
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
export PATH=$PATH:$JAVA_HOME/bin

Note: JAVA_HOME is the installation directory address for installing jdk yourself

(3) Effective jdk environment variable


source /etc/profile

(4) Check whether JDK has been installed successfully


java -version

conclusion

Above is the site to you to introduce linux using CentOS7 installation jdk1.7, hope to help you, if you have any questions welcome to leave a message, this site will reply you in time!


Related articles: