How to install java jdk on ubuntu (linux)
How to install java jdk on Ubuntu? here i provide few steps to demonstrate how it’s work.
Installation Setup
1 ) Issue following command to find out current jdk version in apt-get
apt-cache search jdk
2 ) Install java JDK and JRE with apt-get install
apt-get install sun-java6-jdk sun-java6-jre
3 ) Ubuntu will auto download necessary file from web for installation.
Do you want to continue [Y/n]? y Get:1 http://my.archive.ubuntu.com hardy/main java-common 0.28ubuntu3 [78.2kB] Get:2 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jre 6-06-0ubuntu1 [6334kB] Get:3 http://my.archive.ubuntu.com hardy/main odbcinst1debian1 2.2.11-16build1 [66.2kB] Get:4 http://my.archive.ubuntu.com hardy/main unixodbc 2.2.11-16build1 [289kB] Get:5 http://my.archive.ubuntu.com hardy/multiverse sun-java6-bin 6-06-0ubuntu1 [27.3MB] Get:6 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jdk 6-06-0ubuntu1 [9625kB] 85% [6 sun-java6-jdk 3208002/9625kB 33%]
4) After installation done, jdk and jre will install at /usr/lib/jvm/java-6-sun-1.6.0.06
5) Ubuntu help to create a java symbolic link and put in /usr/bin for shortcut access
4 ) type java -version, DONE !!
Post-Installation Setup
Set JAVA_HOME into environment variable
Copy following statement and append to /etc/profile or .bashrc file, make system set JAVA_HOME into system environment variable.
export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.06"
P.S Please visit How to install JDK on Fedora Core, if you want to know how to install java jdk manually.
This will be use full if you have no internet access in your machine.
Thanks a lot for the instruction. I just downloaded some java plugins into my ubuntu. What folders to put them to in order to be compiled by javac to the correct path.
Sun/Oracle java is no longer in ubuntu or supported, install it from tarball from there website… or this PPA:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk
is that all u do?
I tried many times for installing java as same code as Windows….but not to do that..
But It is easy as according to your Instruction.
Thank u…
Thank you!
Hi from Catalonia! mkyong you save my java developments and when I want something for linux it seems your web is also the best… Congratulations for your web and keep on!!!
Thanks for your kind words, and good to know it help. Actually, mkyong.com did not provides many articles on *nix, will try publish more in future.
[...] then update. Useful links: http://rsbuddy.com/forum/guide-how-run-rsbuddy-linux-117146.html How to install java jdk on ubuntu (linux) Spoiler: iDungeon Pro :: Runescape Botting VPS Sythe.org – Runescape Cheating [...]
thankzzzz!
[...] http://www.mkyong.com/java/how-to-install-java-jdk-on-ubuntu-linux/ [...]
This will work, but the proper way to do this is to use…
sudo apt-get install sun-java6-jdk sun-java6-jre
to install jdk use this
sudo apt-get install openjdk-6-jdk openjdk-6-jre
Looks like oracle just changed the package names to get rid of ‘sun’ from the name.
Open JDK is a different package entirely: http://openjdk.java.net/
Although it works for almost everything you’d want to do.
The apt-get install sun-java6-jdk sun-java6-jre doesn’t work for me , i use openjdk and now i have jdk on my system
thanks alot
export JAVA_HOME=”/usr/lib/jvm/java-6-sun-1.6.0.06;”
I guess you don’t need a semicolon here, do you?
Thanks, article is updated.
thanks akumu for your tips. i dont know why java dont make self installing setup file like windows.
[...] source [...]
i think you forgot to append this to bashrc
export PATH=$PATH:$JAVA_HOME/bin
thanks to kishore and his links….. i could install jdk without internet connection on my machine.
http://kishor15389.blogspot.com/2010/11/install-jdk-on-ubuntu-any-version.html
[...] JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.06;" Ported from: How to install java jdk on ubuntu (linux) function fbs_click() [...]
IF U ARE LOOKING TO INSTALL JDK WITHOUT INTERNET CONNECTION.!IT IS POSSIBLE
IF DOWNLOAD IT FROM OTHER SYSTEM WHICH HAVE INTERNET…
IT TAKE FEW STEPS TO INSTALL THAT..
FOR MORE DETAILED STEPS PLEASE VISIT FALLOWING LINK:
http://kishor15389.blogspot.com/2010/11/install-jdk-on-ubuntu-any-version.html
I’M SURE IT DEFINITELY WORKS…
what means “remastering sys “
Thanks a lot!!
Thank you for this article. I got the installation done without any problems.
I need to install “mplayer” in ubuntu which requires newer version of libc6 since there are a lot of dependent files on libc6 i cannot remove it how do install later version of libc6
i have installed eclipse and android SDK . but for run android emulator.
I need android platform 2.1 . is there a way to download the platform and use .
If there is a way can u give me link to download site of Android platform 2.1
I have copied jdk-6u20-linux-i586.bin to my system (from another system) and then I tried doing the following steps:
apt-cache search jdk
sudo su
apt-get install sun-java6-jdk sun-java6-jre
After doing this, I got stuck at ‘Configuring-jre’ and so I closed the terminal.
I again tried doing the same steps as mentioned above, but then I am getting the following error:
E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
Please suggest me what to do, I am trying to install jdk on my system for the last 1 week.
Please suggest me the solution in very simple break up steps as I am new to java and Linux.
My system runs on Ubuntu 9.1.
If u have an internet connection. u can use the synaptic package manager in applications tab on top left corner and search for
open-jdk 6 and check it for installation . it will automatically get all dependent files .
after installing open jdk u can use ” eclipse “
I do not have open-jdk6 in the synaptic package manager, that’s the reason I had to copy it from other system.
Can you please add me on gmail howaboutsagar@gmail.com so that I can get your help via chat, if you don’t mind.
Download a dvd of ubuntu it will have open-jdk, u only have to select it while installing its in development module.
or
open-jdk6 should definitely be there in synaptic package manager its an online repository for ubuntu.
search for it in highlighting “all” in left.
i some how fell u are not searching for it correctly.
I cannot access my gmail account in office so i am sorry.
If u have an internet connection. u can use the synaptic package manager in applications tab on top left corner and search for
open-jdk 6 and check it for installation . it will automatically get all dependent files .
after installing open jdk u can use ” eclipse “.
I downloaded sun java and install fakeroot and Install java-package in Debian
Now install the package java-package which provides the make-jpkg utility for creating the .deb archive of the Java installation file/archive. Execute
#apt-get install java-package
Create the Java deb package with make-jpkg
Create the deb package of the Sun or Blackdown Java self-extracting .bin archive, or the IBM Java .tgz archive by using make-jpkg. In this example the Java 1.5.0 JRE is used. Note to execute this as a normal user by using fakeroot (which was installed as a dependency of java-package) as make-jpkg cannot be executed as root. Also execute the command from the same directory the JRE/JDK .bin/.tgz file is in, or provide the full or relative path to the JRE/JDK .bin/.tgz file.
fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin
I have a system with no internet connection . how to i install openjdk i need it for eclipse. I have downloaded the dependent files but some of the files seem to be inter dependent, one requiring other so there is a dead lock .
Download the JDK from SUN (Oracle) to your external drive, copy and install it manually in your system.
Hi,
im setting up a private cloud.
will u tell me how to install java in ubuntu enterprise cloud
Thanks ,
I need a bloated eclipse, with plugins for silverlight and android as i don’t have internet connection . how do i do this
why not just copy all the files to your external drive and plug into your server? I used to do this in my so called “secure server” with no internet connection allow.
Can you please provide me the link to download jdk 6 for Ubuntu 9.10.
Kindly provide me the exact path to download the same.
Also if you could provide me with simple installation steps as I am new to this OS and environment.
I also have to install Eclipse on the same OS.
Follow this guide, apt-get will do. Or you can install it manually – http://www.mkyong.com/java/how-to-install-java-jdk-on-fedora-core-linux/
Can you please tell me how to install it manually, if I do not have internet on my system?
Please mention the steps in detail as I am new to both, Ubuntu and JDK.
or you can change to root permissions using sudo su and then you can install what ever you want.
rahul@rahul-desktop:~$ apt-get install sun-java6-jdk sun-java6-jre
E: Could not open lock file /var/lib/dpkg/lock – open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
rahul@rahul-desktop:~$
wat 2 do …plz suggest
Obviously, you do not have enough permission. Please ask your admin/root to assign you the proper permission.
I have succeeded in installing eclipse with android plug ins in windows like the way u said thank you.I will try and do the same in Linux.
use
sudo su command for root permissions , then u can install
try running (enter your login password when prompted for [sudo] password) –
E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable)
E: Unable to lock the download directory
this is also my problem and i m login as root….what should i do…..
Hi,
A video from YouTube on how to install Java 6 on Ubuntu here.
Sunil.
Hi,this is my problem? can any one help me
E:could not get lock/var/lib/dpkg/lock-open(11 Resourse temporarily unavailable)
E:unable to lock the administration direction(/var/lib/dpkg/), is another process using it
[...] Please visit How to install JDK on Ubuntu, if you want to know how to install java jdk with [...]
Hello guys nice tips
Does anyone knoes about how to make update to be done automatically?In other words , the PATH to set itself.
Or i have to do it manually in every update?
hi this is my problem,can anyone help me?
E: Could not open lock file /var/lib/dpkg/lock – open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
I’m root, of course
Ya, you need permission to install the jdk in Ubuntu.
Hi
can u tell me how to install java in ubuntu enterprise cloud
[...] Via | ProgrammerLife [...]
Thanks for easy steps to installing jdk on ubuntu
he!!
the following error is occuring:
E: Could not open lock file /var/lib/dpkg/lock – open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
could you help me??
ya, im root. Please talk to your Unix administrator to get the necessary permission
if u get the correct solution .pls mail me
you do not have permission to do it, check with your administrator
type sudo su
then try installing
I have the last JDK
http://www.elleonplateadodeojosrojos.es/blog/java_development_kit-jdk/
er…sorry i have no idea about it… and i cant simulate the problem here
Here is my suggestion
1) apt-get find to find another jdk version (1.5 may be)
http://www.mkyong.com/linux/find-a-package-with-apt-command-ubuntu/
2) Download JDK from sun and install manually < -- 100% working method
http://www.mkyong.com/java/how-to-install-java-jdk-on-fedora-core-linux/
Hi,
I got following message when trying the command:
apt-get install sun-java6-jdk
–>
Configuring sun-java6-bin
Operating System Distributor License for Java v1.1(DLJ)
and it’s stuck there. I cannot enter anything.
Any idea? Thanks.
try pressing tab. and then when ok is selected, press enter
This is how you get to it, thank you worked for me.
THANK YOU! I could not get past the configuring page either, although in retrospect perhaps I should have thought of your rather simple solution. Again, though, THANK YOU!
The first line should have been
1) <your-mirror-site>/ubuntu/pool/multiverse/s/sun-java6/
Java 6 Update 11 on e.g. 8.04?
1) /ubuntu/pool/multiverse/s/sun-java6/
2) download all *6-11-0ubuntu1_i386.deb and *6-11-0ubuntu1_all.deb
6-11-0ubuntu1_i386.deb packages
3) sudo dpkg -i *.deb
Thanks lonny27
better set your java alternative to be sure you are using the correct java/jdk version:
>update-java-alternatives –list
java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun
java-6-sun 63 /usr/lib/jvm/java-6-sun
>sudo update-java-alternatives –set java-6-sun
and don’t link java_home to a minor version because that will break after an update, better link to the symbolic link to the latest version
>export JAVA_HOME=”/usr/lib/jvm/java-6-sun”
Thanks soma, your tips is useful !
Thanks! I couldn’t get it to work until I updated like you said.
hi akumum, Vatar
nice tips, thanks for extra info
There is also
sudo apt-get install openjdk-6-jdk
in ubuntu its much easier, just do:
sudo apt-get install ubuntu-restricted-extrasthis install everything that is needed like media codecs for mp3s and the such, as well as java.