Open Command Line Terminal (On Windows: [Start > Accessories > Command Prompt]) and type the following command:
java -version
Remember to leave a space between java and a dash. If the command displays the version of Java, you are good to go without Java installation. Otherwise, download it from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Run the Java Installer and follow the instructions.
Visit the following page to get the complete step-by-step explanation how to get JDK or JRE installed on Linux
http://www.oracle.com/technetwork/java/javase/install-linux-self-extracting-138783.html
Check if JAVA_HOME environment variable is set at [My Computer > System Properties > Advanced Tab > Environment Variables > System Variables Block]. If you do not see JAVA_HOME variable listed:
Click on the New button to add a new variable. Enter JAVA_HOME as a Variable name and the Java installation PATH as a Variable value. Press OK button to save.
In the same window find the existing PATH variable and edit it by adding the %JAVA_HOME%/bin; string at the end of the current value. Press OK button to save.
export JAVA_HOME=/home/user/bin/jdk1.5.0_09 export PATH=$JAVA_HOME/bin:$PATHDo not forget to change the first line of the code to the actual PATH where you have installed your JAVA package.