First, check whether rpm-Qa | grep Java is installed.
Environment
The system version is cenos 6.2.
JDK: jdk-6u37-linux-i586.bin
1. Download
Download the appropriate version of jdk-6u37-linux-i586.bin from the Oracle official website and upload it to the/usr/Java directory. (If this directory is not available, create the mkdir-P/usr/Java directory first)
: Http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u37-download-1501634.html
Ii. Installation
- Modify executable: chmod 777 jdk-6u37-linux-i586.bin
- Perform installation./jdk-6u37-linux-i586.bin
When JDK is installed, the JDK installation license is displayed. Press a space to flip the page.ProgramI will ask you if you agree to the above agreement. Of course you agree. Enter 'yes' and decompress JDK to the current directory. The decompression progress is displayed on the screen. After decompression, a new directory named JDK ** will be created under the/usr/Java directory. At least JDK has been installed on cenos.
3. Configure Environment Variables
After installation, you must configure the environment variable VI/etc/profile.
Add the following lines at the end:
Export java_home =/usr/Java/jdk1.6.0 _ 37
Export jre_home =/usr/Java/jdk1.6.0 _ 37/JRE
Export classpath =.: $ java_home/lib: $ jre_home/lib: $ classpath
Export Path = $ java_home/bin: $ jre_home/bin: $ path
Note: You need to change the JDK name to the current JDK version you downloaded.
Set JDK and save and exit. Run source/etc/profile or restart.
4. verify whether the installation is successful
Run the Java-version command to verify whether the system configuration takes effect.
Or echo $ java_home
Note: you do not need to delete the original JDK environment of the system, otherwise it will be very troublesome!