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

Whenever I try to install java on my Ubuntu, it show error like Package dependencies cannot be resolved.

This error could be caused by required additional software packages which are missing or not installable. Furthermore there could be a conflict between software packages which are not allowed to be installed at the same time.

share|improve this question
What happens when you enter sudo apt-get install openjdk-7-jre? Please edit you question and give us the full error message. We need them to diagnose the problem – MadMike Oct 15 '13 at 5:08
Which Java are you trying to install? Oracle or OpenJDK? – minerz029 Oct 15 '13 at 10:12
when i try to run this command sudo apt-get install openjdk-7-jre, then i get error like this Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? and also when i run this sudo apt-get update the error is GPG error: raring Release: The following signatures were invalid: NODATA 1 NODATA 2 – amit Oct 16 '13 at 6:38
and when i try it install it from ubuntu software center , then error like this ca-certificates-java icedtea-7-jre-jamvm java-common libatk-wrapper-java libatk-wrapper-java-jni libbonobo2-0 libbonobo2-common libgconf2-4 libgif4 libgnome2-0 libgnome2-bin libgnome2-common libgnomevfs2-0 libgnomevfs2-common libidl-common libidl0 libnss3-1d liborbit2 openjdk-7-jre openjdk-7-jre-headless openjdk-7-jre-lib ttf-dejavu-extra tzdata tzdata-java – amit Oct 16 '13 at 6:41

If u need to install the Oracle Java Download it from the official site from this link

Oracle Java Download Page

Follow This step to get install

Replace the Version Value Of your downloaded version with were ever jdk1.7.0_21 i have used

#java -version

#sudo mkdir -p /usr/lib/jvm

#sudo mv jdk-7u21-linux-i586.tar.gz /usr/lib/jvm

#cd /usr/lib/jvm

#sudo tar zxvf jdk-7u21-linux-i586.tar.gz

#sudo rm jdk-7u21-linux-i586.tar.gz

#ls -l


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

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

#sudo update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac"

#sudo update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java"

#sudo vi /etc/profile

Add the following entries to the bottom of your /etc/profile file:

#JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21 PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME export PATH

#. /etc/profile

#java -version

Hope tthis Will Fix your issue ...

share|improve this answer
Even though it is nice you took your time and effort to copy & paste your install instructions, there I take some issues with them: 1) It doesn't account for future versions for Java 1.7, in fact it is already outdated since Java 1.7.40 is the current version. 2) It leaves the person following your instruction in the dark about what you are doing. 3) The formatting needs improvements. You are mixing commands an comments. 4) Also, explain why you suggest the proprietary JDK if the open-JDK or even open-JRE could do? – MadMike Oct 15 '13 at 6:35
@MadMike sometimes Oracle's java is just better (being the original Java). It runs Minecraft better, for one. I've always used Oracle Java without a problem (whilst I'd prefer FOSS if it would work as well) – minerz029 Oct 15 '13 at 10:14
@minerz029 i work with Oracle Java every day. I don't question its merrits. But with that OP, is the additional complexity really waranten? – MadMike Oct 15 '13 at 10:23

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.