Environment: VirtualBox 4.1 +redhat Linux 6
A. Download jdk
Javase 6 Download:
Http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html
Javase 7 Download:
Http://www.oracle.com/technetwork/java/java-archive-downloads-javase7-521261.html
Download jdk files jdk-6u27-linux-i586.rpm or jdk-6u27-linux-i586.bin;
Note: It is recommended to download JDK6, because the latest use is very little, but also need time to popularize.
B. Production of ISO files containing JDK installation packages, such as Mypackage.iso, to Mount Mypackage.iso on the Linux operating system. Or use VirtualBox enhancements to achieve file sharing between virtual machines and host hosts;
C. Switch to root and copy JDK installation files jdk-7-linux-i586.rpm to redhat any directory. such as/HOMECP???. Rpm/home
D. Go to the installation file directory (CD ...). )
E. Implementation of the RPM-IVH???. RPM OR./??? Bin (Note: here??? Indicates the name of the installation file, such as jdk-6u27-linux-i586. At this point, the system will begin installing the JDK. A new folder named Java can be found in the/usr directory at the end of the installation. This folder is the installed JDK directory.
F. Setting environment variables
1. Enter the/etc folder, find the file profile and open (command: #vi profiles). Or in the terminal directly input vi/etc/profile (if the VI Editor can not edit, switch to the graphical interface with KWrite open for editing)
2. Locate the export pathuser LOGNAME MAIL hostnamehistsize inputrc and modify it to the following form (press I to insert the editor):
Java_home= '/usr/java/jdk1.7.0′
Path= $JAVA _home/bin: $PATH
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Exportjava_home
Exportpath USER LOGNAME MAIL HOSTNAME histsize inputrc CLASSPATH
Press ESC to exit edit mode, enter at the end of the file: Wq carriage return save and Exit VI
G. Save the file when you have finished setting it up. Log on to the control terminal after restarting the Redhat (or use Source/etc/profile to make the configuration file effective immediately), enter: Java-version, and you can see the correct version number. If you have the words "1.6.0.27" in Java version, your JDK has been installed successfully!