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

Linux server-install jdk

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Install jdk

Jdk is a necessary tool for running or developing java. A lot of software depends on jdk, so you must learn to install jdk.

1. Check the jdk status of the current system

[root@localhost wj] # rpm-qa | grep java

Tzdata-java-2013g-1.el6.noarch

Java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.i686 / / you can see that jdk is installed on the current system, but the version is too old

Java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686

2. Delete the system jdk package

[root@localhost wj] # yum remove-y java-1.6.0

[root@localhost wj] # yum remove-y java-1.7.0

[root@localhost wj] # rpm-qa | grep java / / check whether it has been deleted

Tzdata-java-2013g-1.el6.noarch

3. Go to the official website to download the latest jdk package, http://www.oracle.com/technetwork/java/javase/downloads/index.html, and pay attention to 64-bit or 32-bit when downloading

4. Copy the downloaded package to "/ usr/local/src/" and decompress it.

[root@localhost src] # cp / media/sf_data/jdk-10.0.2_linux-x64_bin.tar / usr/local/src/jdk.tar

[root@localhost src] # tar-xvf jdk.tar

5. Configure the jdk environment variable, open "/ etc/profile", and append the following at the end

[root@localhost src] # gedit / etc/profile

# java environment

Export JAVAHOME=/usr/local/src/jdk-10.0.2 / / this path is the path of jdk decompression.

Export CLASSPATH=.:$ {JAVAHOME} / jre/lib/rt.jar:$ {JAVAHOME} / lib/dt.jar:$ {JAVAHOME} / lib/tools.jar

Export PATH=$PATH:$ {JAVAHOME} / bin

6. Refresh profile

[root@localhost src] # source / etc/profile

7. Test jdk and enter the command "Java-version" in the terminal.

[root@localhost src] # java-version

Java version "1.8.0,181"

Java (TM) SE Runtime Environment (build 1.8.0_181-b13)

Java HotSpot (TM) Client VM (build 25.181-b13, mixed mode)

[root@localhost src] #

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