Install the JDK service in Linux (detailed and complete version)

Source: Internet
Author: User

There are many tutorials for installing JDK in Linux on the Internet, but we often download some incomplete tutorials on the Internet, which leads to environment configuration problems. I will share with you some of my company's configuration processes.

Operating System: Operating System of rat hat

JDK: jdk-6u18-linux-i586.rpm Please download the latest JDK version online

Step 1: uninstall the original jdk1.4.2 Operating System

Log on to the system as the root user and open a terminal input.
# Rpm-Qa | grep gcj

The displayed content contains the following two lines of information:
# Java-1.4.2-gcj-compat-1.4.2.0-27jpp
# Java-1.4.2-gcj-compat-devel-l.4.2.0-27jpp

Uninstall
# Rpm e java-1.4.2-gcj-compat-devel-l.4.2.0-27jpp
# Rpm e java-1.4.2-gcj-compat-l.4.2.0-27jpp

 

Displays a slightly different content for the uninstalled java-1.4.2-gcj, but does not affect the unload.

After the uninstallation is complete, enter Java-version to prompt that the Java command cannot be found;

 

Step 2: Install JDK

Put JDK in/home first

Installer

# Rpm-IVH jdk-6u18-linux-i586.rpm

If the installation protocol is displayed, simply accept it.

 

Install JDK in Linux Step 2. Set environment variables.

# Vi/etc/profile

Add at the end

# Set Java environment

Java_home =/usr/Java/jdk1.6.0 _ 18

Export java_home

Classpath =.: $ java_home/lib. Tools. Jar

Export classpath

Path = $ java_home/bin: $ path

Export path

Save and exit

(There are a few minor issues in many tutorials)

Add permissions to the profile.

Chmod + x/etc/profile

Execute Profile

Source/etc/profile

 

Set system variables (very important)

Set

After the command is executed, the set command prints the relevant system variables;

 

Check the JDK version:

Java-version

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.