Generally installed as user root. First download a JDK from the Sun website. Such as J2SDK1_4_2_05-Linux-i586.bin, put it in / usr / local directory, [root @ server /] # chmod a x j2sdk1_4_2_05-linux.bin (Add execution permission) [ Root @ Server /] # ./j2sdk1_4_2_05-linux.bin (executing J2SDK1_4_2_05-Linux.bin) will generate J2SDK1_4_2_05-Linux.rpm in this directory after execution, using rpm installation: [root @ Server /] # rpm -iv j2sdk1_4_2_05 -linux.rpm After installation, set the environment variable: Add the following code to / etc / profile Last: java_home = / usr / java / j2sdk1.4.2_05 / classpath = / usr / java / j2sdk1.4.2_05 / jre / lib / Rt.jar: .path = $ path: /usr/java/j2sdk1.4.2_05/binexport java_home classpath path finally test [root @ server /] # Source / etc / profile [root @ Server /] # java -version