I had to install Netbeans & JDK in some PCs with no internet connectivity. That’s why, I needed to know how to install Java JDK properly and configure it. Though I mentioned Ubuntu 11.04 version, it should work with any version of newer Ubuntu.
Download Sun JDK
Download the .bin file from official site.
Create Installation + Configuration Scripts
- Copy this code to a file name install.sh and put it in the directory where you put the downloaded jdk. When I prepared this script, jdk version was 1.6.0_25, if you install an upgraded version edit line #4 accordingly in this script.
- Now Copy code from this link & save it in a file name jdk_config.sh, put it in the same directory where you downloaded jdk.
[Note: I copied the original script from the link provided at the end of this article]
Install “java-common”
I’ll find an offline installer of this package and add later. Till then, you can install it by :
sudo apt-get install java-common
Ready to Install!
Right click all the three files (the JDK, install.sh & jdk_config.sh) and select properties. In the Permissions tab, put check mark on “allow executing file as program”
Then open a terminal, go to this directory where all these files exist (to avoid trouble you can put all these files in your home directory) and type:
./install.sh
That’ll do 🙂
Reference:
http://ju-n.net/properly-setting-up-sun-java-5-jdk-on-ubuntu-karmic-lucid
Or you can enable the partner repo and download the package sun-java-jdk (I think that’s what it’s called…). I just did it then
Certain, certain. But as I already mentioned, I had to download & then install them on an offline machine. So, I needed this approach.
No, you didn’t. Just download the .deb and install it. My script was to install JDK 5.
@nicoulaj where did you find “the .deb file” ?
Thank you for your useful post, but how can I install java-common if you said at the beginning that it is an offline install !!
You can find any deb package here: http://packages.ubuntu.com/
You are right! I was in a hurry & couldn’t find the .deb package. Can you please post a link for that?
http://packages.ubuntu.com/oneiric/openjdk-7-jdk