These are the steps I used to install the Java JDK binary,Externally on my System which ain't have Internet.
1.Dowload the latest Java JDK for Linux Platform (in my case,jdk-6u22-linux-i586.bin) from the Sun Java site.Using any System Which Have Internet.
(you can also use jdk-6u3-linux-i586.bin and many other versions)
[*Note:Do not download ".rpm" version of jdk(like jdk-6u22-linux-i586-rpm.bin)]
2.In Terminal Change directory to /usr/local/lib [using comand $cd /usr/local/lib]
3.From there extract the JRE or JDK archive file you downloaded:
$ sudo sh /some/path/jdk-6u3-linux-i586.bin
[In the above commands, replace /some/path with where the JRE/JDK .bin resides and of course replace the filename with what it actually is in your case.]
(In my case: $sudo sh /home/Kishor/Downloads/jdk-6u22-linux-i586.bin)
4.Now Lets create some symlinks so that the executables can be run easily:
Change directory to /usr/local/bin [$ cd /usr/local/bin]
From there execute the following set of commands:
$ sudo ln -sf ../lib/jdk1.6.0_22/bin/* .
[Please Pay attention to the "dot(.)" at the end of the command, it is required and IMPORTENT.
And adjust the directory as well to what you have (e.g. jdk1.6.0_03 in folder /usr/local/lib)
(in mycase it is: jdk1.6.0_22/bin)]
To verify that the installation was successful, execute
$ java -version
The output should look something like this if everything is well
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
6. Now you can Execute Java Programs From any directory from your system,here is a small example of mine:
kishor@ubuntu:~/Desktop$ javac HelloWorld.java
kishor@ubuntu:~/Desktop$ java HelloWorld