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

How to use CentOS7 to install jdk under linux

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to use CentOS7 to install jdk under linux". In the daily operation, I believe that many people have doubts about how to use CentOS7 to install jdk under linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to use CentOS7 to install jdk under linux". Next, please follow the editor to study!

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:

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 so far, the study on "how to use CentOS7 to install jdk under linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Development

Wechat

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

12
Report