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 install java and configure environment variables in centos7

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

Share

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

Today, I will talk to you about how to install java and configure environment variables in centos7. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Installation environment:

Centos7 64 bit

Jdk1.8 64 bit

Xshell Free Edition win10*64 bit

First, you need to check whether the self-contained openjdk is uninstalled (or to determine whether it exists, because usually centos is preinstalled with openjdk):

Enter rpm-qa | grep java or rpm-qa in xshell | grep jdk

Rpm-qa | grep java

Second, if there is a corresponding openjdk showing a list of responses, then you need to uninstall it.

Enter the rpm-e-nodeps tzdata- file name in xshell (this file name is the file name in the list of files you are viewing in openjdk), and then delete it.

Third, create a java repository

1. First go back to the root directory and type cd /.

two。 Then enter mkdir java.

3. Then go to the java directory you just created and type cd java.

4. Enter the download address of java to download.

The operation of the 1-4 steps is as follows.

Cd / mkdir java/ cd java wget-no-check-certificate-no-cookies-header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz

5. Look at the name of the currently downloaded file, and then extract the downloaded java file.

Ls tar-zxvf jdk-8u171-linux-x64.tar.gz

Fourth, after completing the above steps, configure the environment variables.

Vi / etc/profile

At the end of the file, add the following code

Export JAVA_HOME=/java/jdk1.8.0_171 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$PATH / / then save and exit

After performing the save, you must execute the following source / etc/profile to reset the file for it to take effect.

5. Execute java-version to check whether the configuration is successful (the following indicates that the configuration is successful).

Java version "1.8.0144Java (TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot (TM) 64-Bit Server VM (build 25.144-b01, mixed mode) after reading the above, do you have any further understanding of how to install java in centos7 and configure environment variables? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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