0

Yesterday night I was trying to download Java as per instructions given on http://developer.android.com/ .But I messed up somewhere and had to give up the thing. But since morning when ever I try to install or remove some thing I get the following response http://paste.ubuntu.com/1198084/

Please help fast. I am a newbie in android development and have to submit an app within 5 days from now for a project. And I need my linux machine working fine for that.

2 Answers 2

2

A clean install needed. Follow these steps

Download jdk-7u7-linux-i586.tar.gz and put it in your Desktop folder.

Open a terminal and type

sudo apt-get purge openjdk-\*

sudo mkdir -p /usr/local/java

cd ~/Desktop

sudo -s cp -r jdk-7u7-linux-i586.tar.gz /usr/local/java

cd /usr/local/java

sudo -s chmod a+x jdk-7u7-linux-i586.tar.gz

sudo -s tar xvzf jdk-7u7-linux-i586.tar.gz

sudo gedit /etc/profile then copy and paste this at the bottom of the document

Then run these command to set java as default for your system.....

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_07/bin/javac" 1

sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_07/bin/javac

. /etc/profile

Then check your Java version with java -version

5
  • I am not able to excecute the first command itself :( If I am tryin g to remove a package why does it show Java stuff here?? Sep 11, 2012 at 7:15
  • It means Java was not installed correctly. Please follow the rest of procedure.
    – Kaktarua
    Sep 11, 2012 at 7:21
  • even if the first step fails?? and the link dose not give how to download the tar file Sep 11, 2012 at 7:38
  • I can excecute this step 'sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_07/bin/java" 1' It gives this error update-alternatives: error: alternative path /usr/local/java/jre1.7.0_07/bin/java doesn't exist. Sep 11, 2012 at 7:51
  • Ok. It because we are installing jdk not jre. let me edit the post....
    – Kaktarua
    Sep 11, 2012 at 8:00
1

Ohk so thanks @Kaktarua for your help but I realized my mistake. Yesterday night when I was trying to install Sun JDK - Java I messed up somewhere and so it was only half-installed (ohk I don't know the right term for it.)

So whenever I tried to install or remove something, the apt program tried to install the java thing as well once it had installed the current program.

So I had to remove java stuff from the list of queued downloads. That I did using

gksudo gedit /var/lib/dpkg/info/oracle-java7-installer.prerm*

Add "exit 0" to first line, save file and close gedit. Then type

sudo dpkg -P oracle-java7-installer

I searched on Ask Ubuntu and came across this answer which proved very helpful:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .