Install JDK1.6.0 _ 31 on LinuxUbuntu10.04 and Ubuntu11.10

Source: Internet
Author: User
1. Download the jdk rpm installation package: optimized; 1. Download the jdk rpm installation package
:
Http://www.Oracle.com/technetwork/java/javase/downloads/index.html
Sun download jdk page, there are two linux options, one is * rpm. bin a direct is. bin, download the jdk-6u31-linux-i586.bin File Log On As administrator root # sudo-s >>>> enter the administrator password >>>> the following operations are performed by the root user:   2. moving the jdk-6u31-linux-i586.bin to the appropriate installation directory, the installation software should not be in the/home path, so it is easy to involve access permissions of different users, so the maintenance of the program is quite unfavorable. The installation package will be moved to the/usr/local directory. # Music jdk-6u31-linux-i586.bin/usr/local; Move the installation package to the/usr/local directory
# Cd/usr/local
  3. Grant the running permission to the installation package # Chmod 777 jdk-6u31-linux-i586.bin   4. Install the rpm installation package
#./Jdk-6u31-linux-i586.bin; Run the installation package
  5. Set Environment Variables
# Gedit/etc/profile
Add at the end:
Export JAVA_HOME =/usr/local/Jdk1.6.0 _ 31
Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export PATH = $ JAVA_HOME/bin: $ PATH: $ HOME/bin
  6. Because Ubuntu may have a default jdk, such as openjdk, we need to perform the following work to make the jdk installed by default.
# Update-alternatives -- install/usr/bin/java/usr/local/jdk1.6.0 _ 31/bin/java 300
# Update-alternatives -- install/usr/bin/javac/usr/local/jdk1.6.0 _ 31/bin/javac 300 Otherwise, an error will be reported when running java-version:
The program "java" is included in the following software packages:
* Gcj-4.4-jre-headless
* Gcj-4.5-jre-headless
* Openjdk-6-jre-headless
Please try: apt-get install <选定的软件包>
  7.Java-version

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

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.