Install JDK in Linux

Source: Internet
Author: User

Install JDK Linux Step 1. First download jdk (jdk-1_5_0_02-linux-i586.rpm) from the Internet, recommended SUN official website www.sun.com, download and put in the/home directory, of course, other places also.

Go to the installation directory

# Cd/home

# Cp jdk-1_5_0_02-linux-i586.rpm/usr/local

# Cd/usr/local

Add executable permissions to all users

# Chmod + x jdk-1_5_0_02-linux-i586.rpm.bin

#./Jdk-1_5_0_02-linux-i586.rpm.bin

The file jdk-1_5_0_02-linux-i586.rpm is generated, and executable permissions are also added to all users

# Chmod + x jdk-1_5_0_02-linux-i586.rpm

Installer

# Rpm-ivh jdk-1_5_0_02-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/jdk-1_5_0_02

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

PATH = $ JAVA_HOME/bin: $ PATH

Export JAVA_HOME CLASSPATH PATH

Save and exit.

To enable JDK to be used by all users, you can:

Vi/etc/profile. d/java. sh

Enter the following content in the new java. sh file:

# Set java environment

JAVA_HOME =/usr/java/jdk-1_5_0_02

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

PATH = $ JAVA_HOME/bin: $ PATH

Export JAVA_HOME CLASSPATH PATH

Save and exit, and then assign the permission to java. sh: chmod 755/etc/profile. d/java. sh

Install JDK in Linux Step 3. Use the echo command on the terminal to check the environment variable settings.

# Echo $ JAVA_HOME

# Echo $ CLASSPATH

# Echo $ PATH

4. Check whether JDK is successfully installed.

# Java-version

If you see the JVM version and related information, the installation is successful!

Then the installation of JDK in Linux is over and the development door is opened. GOGOGO!

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.