Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use CentOS7 to install jdk1.7 under linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Step 1 Uninstall the original or bring your own jdk

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

(1) use the java-version command to view the current jdk version information

Java-version

(2) use the command rpm-qa | grep java to query the java installed by the operating system itself.

Rpm-qa | grep java

Step 2 download and install jdk

The information found on the Internet, most of the jdk download paths have been invalid, so it is recommended that you go to Baidu to find their own, or download on the official website. A lot of materials here are downloaded using the curl+ address, but we need to know the address path. Another way is to download the installation package directly, throw it into the linux server, and then extract it.

Official website address: jdk download address

Download address: jdk download address

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

Put the downloaded ftp tools 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 a jdk7 directory

Mkdir jdk7

(3) View the files in the / usr/local/jdk7 directory

Ll / usr/local/jdk7 or ls / usr/local/jdk71

(4) decompress the jdk package

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

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

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

Set the jdk environment variable

(1) after installation, you need to configure the environment variables and edit the / 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 address of the installation directory where you installed jdk.

(3) effective jdk environment variable

Source / etc/profile

(4) check whether JDK is installed successfully

Java-version

Summary

The above is the editor to introduce to you the use of CentOS7 to install jdk1.7 under linux, hope to help you, if you have any questions welcome to leave me a message, the editor will reply to you in time!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report