1) Use uname-a to see that the machine is in the first place.
2) JDK official network http://www.oracle.com/technetwork/java/javase/downloads/index.html Download
3) Unzip the installation
We install the JDK to this path:/USR/LIB/JVM
If there is no such directory (the first time of course not), we will create a new directory
Cd/usr/lib
mkdir JVM
Then unzip the compressed package that you just downloaded
Tar zxvf./jdk-7-linux-i586.tar.gz-c/USR/LIB/JVM
Cd/usr/lib/jvm
MV Jdk1.7.0_05/jdk7
4) Configure Environment variables
Vi/etc/profile
Add the following lines at the end:
Export JAVA_HOME=/USR/LIB/JVM/JDK7
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH
Source/etc/profile effective after execution
5) test JDK
#vi Hello.java
public class Hello {
public static void Main (String args [])
{
System.out.println ("Hello world!");
}
}
# Javac Hello.java
# java Hello
Installing JDK under Linux