1. Installing Java.
Things you need to know.
a) JDK - Java Development Kit. (Usually contains one ore more JRE with it)
JRE - Java Runtime Environment.
b) x86 is for a 32-bit OS, and x64 is for a 64-bit OS
1.1 Download the JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
1.2 Uncompress the file.
Command:
tar -xvf jdk-7u40-linux-x64.tar.gz
The above command installs the JDK in the current path.
1.3 Next task is to put the JDK in usr/lib path.
For this create a dir in /usr/lib/jvm
$ sudo mkdir -p /usr/lib/jvm
Change the directory of the current install
$ sudo mv ./jdk1.7.0_40 /usr/lib/jvm/jdk1.7.0_40
1.4 Run the following commands:
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_40/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_40/bin/javac" 1
The above commands set the priority for the current install as 1.
1.5 Alter the ownership and permissions of the executables by running the following commands.
$ sudo chmod a+x /usr/bin/java
$ sudo chmod a+x /usr/bin/javac
$ sudo chmod a+x /usr/bin/javaws
$ sudo chown -R root:root /usr/lib/jvm/jdk1.7.0_40
Now check the java version
$java -version
You must get something like this:
sony@ubuntu:~/Downloads$ java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)
For more instructions checkout --
http://www.oracle.com/technetwork/java/javase/