1: Download jdk6.0
Address: http://java.sun.com/javase/downloads/index.jsp
I downloaded a jdk-6u11-linux-i586.bin.
2: run the CD command to go to the directory where the JDK file is stored and release the compressed package jdk1.6.0 _ 11,
3: Use command: Sh jdk-6u11-linux-i586.bin, press enter until appears
Do you agree to the above license terms? [Yes or No] input: Yes
4. After the release is completed, Run ls to generate a folder in the current directory: jdk1.6.0 _ 011
5. Change the name and execute the command mV./jdk1.6.0 _ 11./jdk6.0. then execute LS and find that the name has been changed to jdk6.0. (this step is not required, but it is mainly for convenience)
6. Change the character set to UTF-8:
[Root @ qudee jdk6.0] # export lang = en_us
[Root @ qudee jdk6.0] # export lc_all = en_us
7. Run the command:./bin/Java-version,
Java version "1.6.0 _ 11"
Java (TM) se Runtime Environment (build 1.6.0 _ 11-b05)
Java hotspot (TM) server VM (build 1.6.0 _ 011-b05, mixed mode)
Then execute Java-version
Java version "1.4.2"
Gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
Copyright (c) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is no
Warranty; not even for merchantability or fitness for a particle purpose.
An error occurred because the environment variable is not set.
8. Set environment variables and execute command VI/etc/profile
The edit box appears.
Hostname = '/bin/hostname'
History Size = 1000
Path for adding environment variables below:
Java_home =/opt/Java/jdk6.0
Class_path = $ java_home/lib: java_home/JRE/lib: java_home/lib/tools. jar: $ class_path
Path = $ java_home/bin: $ path
Export path user LOGNAME mail hostname histsize inputrc added after this line
Export class_path java_home
OK! Press ESC to release the edit box, press SHIFT +;, and enter WQ (write, save, and release)
Restart the system.
9. Check whether the installation is successful. Enter the command: Java-version
Message:
Java version "1.6.0 _ 02"
Java (TM) se Runtime Environment (build 1.6.0 _ 02-b05)
Java hotspot (TM) server VM (build 1.6.0 _ 02-b05, mixed mode)
The installation is successful!