DevOps Zone is brought to you in partnership with:

Anthony Goubard is a freelance Senior Software Engineer from Amsterdam. He has developed in Java since 1995. He has developed many softwares available at http://www.japplis.com and is the main developer of the Web Services framework XINS. Anthony is a DZone MVB and is not an employee of DZone and has posted 33 posts at DZone. You can read more from them at their website. View Full User Profile

Installing Java on Ubuntu

12.18.2012
| 7937 views |
  • submit to reddit

 Recently I wanted to test Ant Commander on Linux. So I decided to install Ubuntu 12.04 in Virtual Box. Java doesn't seem to work out of the box, at least for applets. So I installed Oracle Java JRE for Linux.

The instructions on Oracle failed on my computer (rpm command failed to find some binaries needed for the installation) so I had to figure out how to install it.
Here are the instructions so you don't have to search for them. The instruction sudo passwd root is only if you don't have a root password yet.

Go to http://java.com/en/download/linux_manual.jsp
Download the Linux RPM version.
Then

sudo passwd root

su

cd /usr

mkdir java

cd java

mv /home/#username#/Downloads/jre-7u9-linux-i586.rpm .

apt-get install alien

alien jre-7u9-linuxi586.rpm

dpkg -i jre_1.7.009-1_i386.deb

cd /usr/lib/firefox-addons/plugins/

ln -s /usr/java/jre1.7.0_09/lib/i386/libnpjp2.so .

You may also to open the Text Editor (Ubuntu -> Text Editor)
Open -> Type a file name icon (on the top left corner) -> .bashrc (from your home directory)
Add this line at the end

PATH=/usr/java/jre1.7.0_09/bin:$PATH

And save the file

Published at DZone with permission of Anthony Goubard, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Gundar Abella Posse replied on Tue, 2012/12/18 - 5:14am

You can give a try the WebUpd8 Java PPA. Last version of Java6 and Java7.

http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

Rodrigo Martins replied on Wed, 2012/12/19 - 11:39am

I also wrote a post about that: Installing Java 

Thai Dang Vu replied on Wed, 2012/12/19 - 12:31pm

If you don't bother use alien to convert a rpm to a deb, then I think going to oracle.com and downloading jdk-7u10-linux-x64.tar.gz are better.

Dean Schulze replied on Wed, 2012/12/19 - 4:20pm

This will install OpenJDK

sudo apt-get install openjdk-7-jdk

I think that package name incorrect.  To be sure about the correct package name from the shell type

jps

and Ubuntu will show the correct package name.  (The jps command is a binary from the JDK and if you don't already have a JDK installed Ubuntu will show the suggested packages to install).


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.