There is an easier way to install Oracle Java (JDK and JRE) on Elementary OS Luna. Thanks to webupd8 team that provide the PPA for Oracle Java installer. This tutorial is going to show you how to install the latest Oracle Java JDK 8 on Elementary OS Luna. This installation method will install the Java Development Kit (JDK) and Java Runtime Environment (JRE). Also, it will configure the browser to use Java plugin as well.
First, we need to add the webupd8 PPA to Elementary OS Luna. Execute this command on Terminal
sudo add-apt-repository ppa:webupd8team/java
Now, update system
sudo apt-get update
Next install Java
sudo apt-get install oracle-java8-installer