1. Download and install jdk7.0 for Linux
The version I downloaded is: jdk-7u2-linux-i586.rpm
is: http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html
2, upload the jdk-7u2-linux-i586.rpm to the user directory
3, [[email protected] ~]RPM-IVH jdk-7u2-linux-i586.rpm
Preparing ... ########################################### [100%]
1:JDK ########################################### [100%]
Unpacking JAR files ...
Rt.jar ...
Jsse.jar ...
Charsets.jar ...
Tools.jar ...
Localedata.jar ...
Plugin.jar ...
Javaws.jar ...
Deploy.jar ...
[Email protected] ~]#
4. Configure environment variables by modifying the/etc/profile file to see the JDK installation directory in Linux first
[Email protected] ~]# ls/usr/java/
Default JDK1.7.0_02 Latest
The visible directory is/usr/java/jdk1.7.0_02, and the value of Java_home is this value.
Add the following to the end of the file:
Export java_home=/usr/java/jdk1.7.0_02
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tool.jar
After Setup is complete, exit, or use the Source/etc/profile mission to make the settings effective.
Annotations:
A./usr/java/jdk1.7.0_02 is the JDK installation directory
B. Use the colon ":" to separate the paths under Linux
C. $PATH/$CLASSPATH/$JAVA _home is used to refer to the value of the original environment variable, especially when setting the environment variable to be careful not to overwrite the original value.
D. Current directory in Classpath "." Cannot be lost.
E. Export is exporting these three variables as global variables.
F. The case must be strictly differentiated.
5, test success or not.
[Email protected] java]# java-version
Java Version "1.7.0_02"
Java (TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot (TM) Client VMs (build 22.0-B10, mixed mode, sharing)
[Email protected] java]#
Description succeeded.