Android OS Forum banner

[HOWTO] Install Java 7 on Ubuntu 12.04

131K views 15 replies 8 participants last post by  Maverick39 
#1 ·
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.

First:

Code:
sudo add-apt-repository ppa:eugenesan/java<br />
sudo apt-get update<br />
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.

Second:

Download Java directly from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html

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

Third:

Code:
sudo gedit /var/lib/dpkg/info/oracle-java7-installer.postinst
Now scroll down and find the following:

Code:
<br />
		<br />
		echo "Downloading..."<br />
		rm -f $FILENAME<br />
		WGETRC=wgetrc wget $PARTNER_URL <br />
			|| fp_exit_with_error "download failed"<br />
		rm -f wgetrc<br />
		echo "Download done."
Now put a # next to each line between "Downloading..." and "Downloading done."

Code:
     <br />
               <br />
		echo "Downloading..."<br />
		#rm -f $FILENAME<br />
		#WGETRC=wgetrc wget $PARTNER_URL <br />
			#|| fp_exit_with_error "download failed"<br />
		#rm -f wgetrc<br />
		echo "Download done."
Save, and go back to your terminal.

Finally, do:

Code:
sudo apt-get install oracle-java7-installer
Java should now install properly.

Source:

http://www.ubuntugeek.com/how-to-install-oracle-java-7-in-ubuntu-12-04.html (most helpful info is in the comments)

Sent from my ADR6400L using RootzWiki
 
See less See more
#6 ·
I run the script fine, but when I try to see my java version I get the following:

java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
Try: sudo apt-get install <selected package>
 
#11 · (Edited by Moderator)
they actually did this in 11.10, it sucked to install Java I had to set a PPA, which I really don't like doing if its just some guy hosting packages, but that's the best I really found. I know it sounds silly and naive but I feel like I'd trust someone over here more than a random site. Thanks for this guide though! Unfortunately I will have to be doing this, because my upgrade from 11.10 somehow was corrupted, I think in the download, and did not work properly. So right now I'm sitting here waiting for it to finish installing. I've always loved that I could use the browser before it's done installing. It's so convenient and gets rid of the 'sitting impatiently waiting to do something' feeling most people get when installing a new OS. Also the new Twitter feed right into the installation box is a genius idea by Canonical. I'll be sure to point people to this guide, assuming its fairly straight-forward to do once I'm done installing. Thanks again!
 
#13 · (Edited by Moderator)
Should be

sudo mv /home/maverick/Desktop/jdk-7u3-linux-x64.tar.gz /var/cache/oracle-java7-installer/jdk-7u3-linux-x64.tar.gz

Sent from my ADR6400L using RootzWiki
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top