[HOWTO] Install Java 7 on Ubuntu 12.04

I'm not sure if this is in the right spot (if not I apologize), but I figure it is because this relates directly to building Android.

When I upgraded to Ubuntu 12.04, all the sudden I couldn't install Java (sha256sum mismatch jdk-7u3-linux-x64.tar.gz), which means I can't do much deving. Well I searched through the interweb and finally found a solution.


sudo add-apt-repository ppa:eugenesan/java sudo apt-get update sudo apt-get install oracle-java7-installer

By now, you have probably gotten an error and the terminal has stated that Java was not installed. No problem.


Download Java directly from Oracle:

Now, move what you just downloaded to /var/cache/oracle-java7-installer/


sudo gedit /var/lib/dpkg/info/oracle-java7-installer.postinst

Now scroll down and find the following:

echo "Downloading..." rm -f $FILENAME WGETRC=wgetrc wget $PARTNER_URL \ || fp_exit_with_error "download failed" rm -f wgetrc echo "Download done."

Now put a # next to each line between "Downloading..." and "Downloading done."

echo "Downloading..." #rm -f $FILENAME #WGETRC=wgetrc wget $PARTNER_URL \ #|| fp_exit_with_error "download failed" #rm -f wgetrc echo "Download done."

Save, and go back to your terminal.

Finally, do:

sudo apt-get install oracle-java7-installer

Java should now install properly.


(most helpful info is in the comments)

Show Accepted Answer

Guest Quick Reply (No URL, BBcode or HTML)

Last post by kunze.terrill
4 hours ago
Last post by muller.nina
4 hours ago
Last post by ffisher
4 hours ago
Last post by conroy.bulah
5 hours ago
Last post by edibbert
1 hour ago
Last post by alf43
4 hours ago
Last post by nelda.windler
49 minutes ago
Last post by rfunk
1 hour ago
Last post by lemke.jo
4 hours ago