Most things will work fine with OpenJDK7 but if you are running into one of the exceptions the easiest way to install JRE7 is:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
The page that gives detailed instructions is Here.
Source: http://www.webupd8.org
Quote from source page:
If you really need to use Oracle (ex Sun) Java instead of OpenJDK in Ubuntu, here's an easy way to do it: a PPA repository to install and keep your computer up to date with the latest Oracle Java 7 (Java JDK which includes JRE).
The PPA installed with the above command does not actually contain Oracle Java. ** Oracle licenses no longer allow Java to be redistributed.** This PPA works by connecting to Oracles official download server and downloads the file, it is then installed by apt-get
or can be installed by the Ubuntu Software Center. It works the same way that the Flash Pluging installer works. Here is what the PPA manager(which is also the soure of these directions, see this link(same link as above)) here is some more of the page pasted here.
Oracle JDK7 itself is not hosted in the PPA because that's not allowed by the new Java license (which is also the reason why it has been removed from the official Ubuntu repositories); the package in the PPA automatically downloads (and installs) Oracle Java JDK 7 from its official website and installs it on your computer, just like the flashplugin-installer package does.