Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First When I downloaded java from official website I got confused how to install it.

Then I searched it on software center and I found it. But when I install it, it starts but instantly stops and the line highlighting the installation status in progress tab doesn't move forward.

Then I searched on the internet and tried installing it by terminal, but the terminal said that I first have to configure something that I dont know. It tells me to run this sudo dpkg-configure -a and when I run this command the terminal process stops in the middle and even after leaving it for about an hour it doesn't proceed.
After that when I want to close the terminal, it says that the terminal is in hte middle of a process, and closing it would interrupt it.
So I am greatly confused because even other software, like gimp image editor, are not getting installed.

Can anyone help me? Thanks in advance.

share|improve this question
Please copy the error messages that you are getting from the terminal and paste them in your question, it will help us help you further, without any more information it will be hard to help you in anyway. – Bruno Pereira Oct 31 '12 at 11:27
when itype the command "sudo add-apt-repository ppa:webupd8team/java" its asks for password and that task completes successfully. After that when i type this command "sudo apt-get update" it is processed but in the meanwhile suddenly it gets sopped and starts showing something else saying that "E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem." Then When i manually run d command "sudo dpkg --configure -a" it gets stopped in the middle.. and it doesnt proceed furthe even after keeping it for hours.. and that is where i am facing problem.. – Aditya Oct 31 '12 at 14:37

I assume that you have downloaded Java in tar.gz format in Download folder.

Extract the downloaded package by running the commands below.

tar -xvf ~/Downloads/jdk-7u3-linux-i586.tar.gz

create a folder for Java JDK files and folders

sudo mkdir -p /usr/lib/jvm/jdk1.7.0 

Move all the JDK files and folders to the new location

sudo mv jdk1.7.0_03/* /usr/lib/jvm/jdk1.7.0/

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

create a Mozilla plugins folder in your home directory

mkdir ~/.mozilla/plugins/

create a symbolic link to your Mozilla plugins folder. For 64-bit systems, replace ‘i386’ with ‘amd64’.

ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/i386/ ~/.mozilla/plugins/
share|improve this answer
Yep, that's what you must do. nice answer. – Dr_Bunsen Oct 31 '12 at 12:31
nope...that didnt workfor me..:( – Aditya Oct 31 '12 at 15:21
  1. Add the WebUpd8 PPA

    sudo add-apt-repository ppa:webupd8team/java
  2. Update the repos

    sudo apt-get update
  3. Install Java 7 JDK

    sudo apt-get install oracle-java7-installer

If you want to uninstall

sudo apt-get remove oracle-java7-installer

Installing OpenJDK version

sudo apt-get install openjdk-7-jdk
share|improve this answer

If the process freezes in Ubuntu Software Center or in terminal, you should kill the process manually from terminal by typing killall dpkg, if you don't kill the process it wont let you install anything, neither from software center nor from terminal.

share|improve this answer
But when you do this, you get a locked file which you have to remove in order to be able to install/remove/update stuff again. – Dr_Bunsen Oct 31 '12 at 13:34

Try this. This worked like a dream.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.