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

Installation and uninstallation of JDK under Linux

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

Share

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

One. Install JDK

1. Log in using the root user

two。 Determine if JDK has been installed

# java-version

3. Create an installation directory if it is not installed, and establish the installation path under / usr/java

# mkdir-p / usr/java

4. Upload jdk-6u45-linux-x64-rpm.bin to the / usr/java path (the name of the JDK installation package varies with the version, and the subsequent operation commands need to be adjusted accordingly)

5. Add executable permissions to the installation package

# chmod + x jdk-6u45-linux-x64-rpm.bin

6. Install JDK and execute it under root user: (other users need to have permission to operate on the full path if they are running, otherwise they will be prompted that the permission is insufficient)

#. / jdk-6u45-linux-x64-rpm.bin

7. Configure JDK environment variables

# vi / etc/profile

Add the following to it (depending on the actual configuration, the file name may be different)

Export JAVA_HOME=/usr/java/jdk1.6.0_45

Export JAVA_BIN=/usr/java/jdk1.6.0_45/bin

Export PATH=$JAVA_HOME/bin:$PATH:

Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Export JAVA_HOME JAVA_BIN PATH CLASSPATH

To make the / etc/profile file take effect immediately after modification, you can use the following command:

# source / etc/profile or

#. / etc/profile

8. Check whether the JDK installation is successful

II. Uninstall JDK

1. Uninstall needs to be done when there is a problem with the installation or must be uninstalled (many different versions of JDK can coexist, and the default JDK can be set by configuring the environment variable)

two。 Log in using the root user

3. List installed jdk plug-ins

View the default JDK: rpm-qa | grep gcj

View the rpm version of JDK: rpm-qa | grep jdk

4. Execute rpm-e-nodeps xxxx (xxxx is the result of the above linux command)

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