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 replace the default jdk on a linux host

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

Share

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

It is believed that many inexperienced people don't know what to do about how to change the default jdk on the linux host. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Jdk on linux hosts generally defaults to / usr/lib/jvm

[root@bpsmanage1 jvm] # ls

Java java-1.6.0-openjdk-1.6.0.0.x86_64 java-openjdk jdk-7u71-linux-x64.tar.gz jre-1.6.0 jre-openjdk

Java-1.6.0 java-1.6.0-openjdk.x86_64_bak jdk1.7.0_71 jre jre-1.6.0-openjdk.x86_64

Modify the configuration file

[root@bpsmanage1 ~] # pwd

/ root

-rwxr-xr-x 1 root root 333 May 11 17:52. Bash _ profile pay attention to the permissions, owners and groups of the file

It is best to back up the .bash _ profile file before editing

[root@bpsmanage1 ~] # vi .bash _ profile

# .bash _ profile

# Get the aliases and functions

If [- f ~ / .bashrc]; then

. ~ / .bashrc

Fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

Export PATH

Export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_71

Export JRE_HOME=$JAVA_HOME/jre

Export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib

Export PATH=$JAVA_HOME/bin:$PATH

Save effective

Source .bash _ profile

[root@bpsmanage1 ~] # java-version

Java version "1.7.0Y71"

Java (TM) SE Runtime Environment (build 1.7.0_71-b14)

Java HotSpot (TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Note: you need to restart crt if other users check the jdk version and still haven't changed.

After reading the above, have you mastered how to change the default jdk on the linux host? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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