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