Download jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.
Shared directory
Copy the jdk file in the shared directory to the/tmp directory for installation.
Cp, mnt, hgfs, linuxsoft, jdk-7u21-linux-i586.rpm, tmp/
Go to the/tmp directory and install
Yeshang:/mnt/hgfs/linuxsoft # cd/tmp/
Yeshang:/tmp # rpm-ivh jdk-7u21-linux-i586.rpm
Set environment variables after installation
# Vi/etc/profile
Add at the end
# Set java environment
JAVA_HOME =/usr/java/jdk1.7.0 _ 21
CLASSPATH =.: $ JAVA_HOME/lib. tools. jar
PATH = $ JAVA_HOME/bin: $ PATH
Export JAVA_HOME CLASSPATH PATH
Save and exit.
Edit the java. sh script
Vi/etc/profile. d/java. sh
Enter the following content in the new java. sh file:
# Set java environment
JAVA_HOME =/usr/java/jdk1.7.0 _ 21
CLASSPATH =.: $ JAVA_HOME/lib/tools. jar
PATH = $ JAVA_HOME/bin: $ PATH
Export JAVA_HOME CLASSPATH PATH
Check whether JDK is successfully installed.
# Source/etc/profile // make the current configuration take effect immediately
# Java-version
Yeshang:/usr/java/jdk1.7.0 _ 21 # java-version
Java version "1.6.0 _ 20"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (SUSE-1.2.1-i386)
OpenJDK Client VM (build 19.0-b09, mixed mode)
Install 1.7 to display 1.6 ???