Install and configure JDK in Linux

Source: Internet
Author: User

Openjdk is usually installed in Linux. However, in development, sunjdk is required in some cases. In this case, you can only uninstall openjdk and install sunjdk.
1. query existing installation versions
Rpm-Qa | grep JDK
2. Uninstall openjdk
Sudo Yum-y remove java-1.6.0-openjdk
3. Modify permissions
# Chmod 755 jdk-6u45-linux-i586-rpm.bin
4. Execute
/Jdk-6u45-linux-i586-rpm.bin
Or
Sh jdk-6u45-linux-i586-rpm.bin
5. Installation
Rpm-IVH jdk-6u45-linux-i586.rpm
6. modify the configuration file
# Vi. bashrc

#. Bashrc

# Source Global definitions
If [-F/etc/bashrc]; then
./Etc/bashrc
Fi

# User specific aliases and functions

######################################## #######################
# Edit by Hu Haibin (haib.hu@sunyard.com ##
######################################## #######################
Export java_home =/usr/Java/jdk1.6.0 _ 45
Export Path = $ path: $ java_home/bin
Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
######################################## #######################

Or modify/etc/profile.

######################################## #######################
# Edit by Hu Haibin (haib.hu@sunyard.com ##
######################################## #######################
Export java_home =/usr/local/Java/jdk1.6.0 _ 45
Export java_bin = $ java_home/bin
Export Path = $ path: $ java_home/bin
Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export java_home java_bin path classpath
######################################## #######################
7. Effective
Source. bashrc

Related Article

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.