Install JDK 1.6 (jdk-6u45-linux-x64.bin) under Linux system (x64)
One, check to see if the JDK is installed:
# Rpm-qa | --version
Second, download the installation file:
Http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
Download the corresponding version of the JDK according to your liunx version, and if you install a 32-bit JDK on the X64, you will get an error.
To see how many bits of the system:
#uname-A
According to the result, download file: Jdk-6u45-linux-x64.bin
Linux x86:32 bit operating system;
Linux x64:64 bit operating system;
Jdk-6u45-linux-x64-rpm.bin after running will extract a RPM package, can be installed RPM-IUH command;
Jdk-6u45-linux-x64.bin will extract all files to the JDK subdirectory of the current directory after running;
Three, start the installation
(1), first build the folder, the new Java folder under USR:
#mkdir/usr/java
(2), copy the downloaded JDK to the Java directory;
(3), execute command gives installation file 777 permission:
# Cd/usr/java (mkdir java– This directory needs to be created)
A,jdk-6u45-linux-x64-rpm.bin File Installation:
# chmod 777 Jdk-6u45-linux-x64-rpm.bin ← Modify to executable #.
/jdk-6u45-linux-x64-rpm.bin -ivh jdk-6u45-linux-x64.rpm← Select Yes until installation is complete
B,jdk-6u45-linux-x64.bin File Installation "Recommended installation of this file":
# chmod 777 Jdk-6u45-linux-x64.bin ← Enable the current user to have Execute permissions
#. /jdk-6u45-linux-x64.bin ← Select Yes until installation is complete
Installation prompt: error:failed dependencies:/bin/grep is needed by jdk1.6.0_65-2000:1.6.0_65-fcs.x86_64;
Solution: Add two parameters--nodeps and--force in Rpm-ivh jdk-6u45-linux-x64.rpm--nodeps--force;
Four, configure environment variables:
(1), execute the command, open the file:
# Vi/etc/profile
(2), add the configuration environment variable:
Export java_home=/usr/java/jdk1.6. 0_45export java_bin=/usr/java/jdk1.6.0_45/binexport PATH=$ PATH: $JAVA _home/binexport CLASSPATH=.:
$JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jarexport Java_ HOME java_bin PATH CLASSPATH
Save File:
Press ESC first to enter control mode, and then
#:wq (Save and exit)
Press the ESC key to jump to command mode:
: w save file but do not exit VI
: W file saves the modification to file without exiting VI
: w! Force save, do not exit VI
: Wq save file and Exit VI
: wq! Force save file and Exit VI
: Q Do not save files, back Vhuvi
: q! Do not save file, Force exit VI
: e! Discard all changes and edit from the last time the file was saved
(3) The implementation takes effect
#. /etc/profile (there are spaces between dots and/)
If you are executing. /etc/profile prompt: Command not found
Solution:
File edit content Error, enter the editing mode: I modify the file;
Then enter the control mode ESC,:WQ save exit;
Finally executed. /etc/profile file entry into force;
VI mode, enter: Set Nu can display the line number.
Five, uninstall:
#java-version
Six, uninstall the JDK:
To view JDK information:
#rpm-Q JDK
Uninstalling the JDK:
#rpm-E--nodeps jdk-1.6.0_45-fcs.i586
Confirm Uninstall again:
#rpm-Q JDK
Install JDK 1.6 (jdk-6u45-linux-x64.bin) under Linux system (x64)