Install and configure Java in Linux

Source: Internet
Author: User

Install

Take jdk1.6.0 _ 43 as an example.

Download jdk-6u43-linux-x64.bin, http://www.oracle.com/technetwork/java/javase/downloads/index.html

Add executable permission chmod + x jdk-6u43-linux-x64.bin,

Run./jdk-6u43-linux-x64.bin to generate directory jdk1.6.0 _ 43

Copy to/usr/share, MV jdk1.6.0 _ 43/usr/share

In addition, the jdk-6u43-linux-x64.bin decompress all files to the JDK $ verison _ $ update directory of the current directory,

Jdk-6u43-linux-x64-rpm.bin decompress to generate RPM package,Run the rpm-IVH command to install

 

Configure Environment Variables

Add under/etc/profile

# Set Java environment
Java_home =/usr/share/jdk1.6.0 _ 43
Path = $ java_home/bin: $ path
Classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export java_home
Export path
Export classpath

 

Test

[Root @ localhost ~] # Echo $ java_home
/Usr/share/jdk1.6.0 _ 43
[Root @ localhost ~] # Echo $ path
/Usr/share/jdk1.6.0 _ 43/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin: /usr/sbin:/usr/bin:/root/bin
[Root @ localhost ~] # Echo $ classpath
.:/Usr/share/jdk1.6.0 _ 43/lib/dt. jar:/usr/share/jdk1.6.0 _ 43/lib/tools. Jar

[Root @ localhost ~] # Java-version
Java version "1.6.0 _ 43"
Java (TM) se Runtime Environment (build 1.6.0 _ 43-b01)
Java hotspot (TM) 64-bit server VM (build pipeline 14-b01, mixed mode)

 

 

 

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.