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 configure JAVA_HOME in Centos7

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Today, I will talk to you about how to configure JAVA_HOME 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.

A locate the JDK installation path

1. Terminal input:

Which java

The output is:

/ usr/bin/java

two。 Terminal input:

Ls-lr / usr/bin/java

The output is:

/ usr/bin/java->

3. Terminal input

Ls-lrt / etc/alternatives/java

Output:

/ etc/alternatives/java-> / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre/bin/java

So far, we have determined that the installation directory of java is: / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64

B configure JAVA_HOME

1. Open the file that configures the environment variable

Vi / etc/profile

two。 Add the following configuration:

Export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64export JRE_HOME=$JAVA_HOME/jreexport CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

: wq save exit.

3. Let the configuration take effect

Source / etc/profile

4. Test configuration results

Echo $JAVA_HOME after reading the above, do you have any further understanding of how to configure JAVA_HOME in Centos7? 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

Internet Technology

Wechat

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

12
Report