Install JDK in Linux as follows:
Step 1: Check whether the built-in JDK of Linux is installed
(1) view the installed JDK:
# Rpm-Qa | grep JDK plugin to view JDK information or directly execute
Or
# Rpm-Q JDK
Or
# Java-version
(2) rpm-Qa | grep JDK uninstall:
(3) If the rpm-e RPM package name (as shown above) has a dependency, uninstall the upper-layer package first.
Step 2: Install JDK
<1> download jdk-1_5_0_14-linux-i586-rpm.bin or jdk-1_5_0_14-linux-i586.bin from sun
Create a Java folder under/USR and put the installation package in the/usr/Java directory.
# Mkdir/usr/Java
<2> install JDK
# Cd/usr/Java (mkdir Java-this directory needs to be created)
① Install jdk-1_5_0_16-linux-i586-rpm.bin files
# Chmod 777 jdk-1_5_0_16-linux-i586-rpm.bin supervisor modified to Executable
#./Jdk-1_5_0_16-linux-i586-rpm.bin accept select YES to agree to the above agreement
# Rpm-IVH jdk-1_5_0_16-linux-i586.rpm configure Select Yes until installation is complete
② Install jdk-1_5_0_16-linux-i586.bin files
# Chmod A + x jdk-1_5_0_16-linux-i586.bin grants the current user permission to execute
#./Jdk-1_5_0_16-linux-i586.bin plugin Select Yes until installation is complete
Step 3: Configure Environment Variables
<1> # vi/etc/profile
<2> Add the following lines at the end:
Export java_home =/usr/Java/jdk1.5.0 _ 16
Export classpath =.: $ java_home/JRE/lib/RT. jar: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export Path = $ path: $ java_home/bin
<3> # source/etc/profile takes effect after execution
Step 4: Test JDK
# Vi hello. Java
Public class Hello {
Public static void main (string ARGs [])
{
System. Out. println ("Hello world! ");
System. Out. println ("2009/2/19 ");
}
}
# Javac hello. Java
# Java hello
Hello world!
2009/2/19
The installation is successful!
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/candle806/archive/2009/05/14/4187017.aspx