Thursday, November 11, 2010

Install JDK on UBUNTU (any version) Without Internet Connection

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)]

5.Verify installation

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
kishor@ubuntu:~/Desktop$ java HelloWorld
Hello World!!



  1. cool Buddy...i am going to try this..lso i can see no new posts...we expect more stuff from you buddy

  2. I tried the tutorial. There is the jdk folder inside of the /usr/local/lib and all the other files as well. But when i tried to verify the version, it says that try out an apt-get install.
    why is that? Could you please help me to figure out this and install jdk correctly?


  3. all steps sucessfull./..i download java from
    but i want java applets to be run of firefox mozilla on ubuntu...its s not happening yet..wht to do to install java plugin for firefox

  4. Sorry guys i've been busy....

    Wait for my next that i'll tell

    how to install almost all plug ins for ubuntu without internet connection and also VLC player..

  5. hi kishore
    My system say's "No such file or directory" for the 2nd step...

    I've downloaded the latest jre from java site in my Downloads folder
    location of the bin file is as follows


    Plz tell me where to save the bin file and

  6. Hi KANHAI i guess u downloaded the "jre" file it is just JAVA RUNTIME ENVIRONMENT....
    "Jre" can not execute the java programs it can only run compiled class u need to download the JDK(Java Development Kit) it has Jre too...
    if u downloaded the ".bin" file to Downloads folder then 3rd step will be
    $ sudo sh /uradminname/home/Downloades/jdk-6u3-linux-i586.bin for u...
    if u are using UBUNTU then there ain't no go wrong in 2nd step....

  7. hey this is a very simple guide for a fresher like me in the linux environment. Thank u very much...the results do not show as I feel that the previous version of jdk needs to uninstall first...can u please help how to d that??

  8. i encounter the exact same issue as earninginternetmoneyeasy.

  9. Set PATH to point to the jre or jdk that is to be used will resolve the issue I and earninginternetmoneyeasy mentioned.

  10. Sorry guys i was u able to reply to your comments..
    @Neha : First of all Thanks for your Fallow up on My blog...You try removing previous JDK from your Package Manager... That's a quit easy method i guess.. you open the Package manager then select the package to remove it... It might be named as "Open source jdk"...
    good luck... let me know after u tried that one please..

  11. kanhai i got a same problem you should set environment variable PATH first write following in console

    export PATH="/usr/local/lib/jdk1.6.0_21/bin"

    for my case
    if you find it helpfull pls reply something to
    ill be very happy if any reply comes

  12. About the PATH variable. I had the same problem and resolved it in this way:
    PATH solution

  13. i am not able install jdk1.6 in my linux mint. so tell me the steps

    1. Dude - you have to do better than "so tell me the steps". Google is your friend, but you have to do your own work. ;-)

  14. thanks, worked perfectly. I was a newbie with linux and was finding it bit intimidating eventhough Ubuntu was more or less windows experience. It was really helpful

  15. Thanks a lot Kishor!

    Just a suggestion: You should add a line about 'PATH', as Suraj has mentioned in his comment for completeness of your awesome post!

    Thanks again!

  16. Hey Kishor, just a modification to the command that Suraj gave. I am a newbie at software btw and when I tried his command my entire Ubuntu stopped working (I am using Ubuntu 10.40 in a VM). The command that worked for me was:

    export PATH=$PATH:/usr/local/lib/jdk1.6.0_whateverVersion/bin/:/usr/local/bin

    Basically you have to add the previous paths as well as the new one.

    Anyway other than that AWESOME TUTORIAL!!!!

  17. Hey man - I just happened to surf across your page when I was trying to fix sun's jdk. Thanks...your method worked perfectly to install sun-java6-jdk to Ubuntu 10.04LTS after it had been deprecated from the repositories. Peace, man.

  18. i have done your steps. but it couldn't be installed in my linux server. please help me.

  19. This comment has been removed by the author.

  20. I have read your blog its very attractive and impressive. I like it your blog. Java Training in Chennai

  21. Hi... I am newbie from your blog post. you have post an very informative information. its very useful to me. keep update for our vision. thank you.

    White Label Website Builder