I’ve seen a couple of ways to do this on the internet but the easiest is through apt-get and ppa.
The catch with doing anything in Java on Ubuntu is always the same - Ubuntu doesn’t ship with Oracle’s Java installed. Instead, Ubuntu ships with Open JDK installed. Open JDK is an open source version of Java. Some may argue that you can develop with and probably run most things Java with Open JDK. That may be the case, but for me I find the Oracle Java to be more trustworthy for production environment so will be using the Oracle bits. This is simply a matter of opinion.
Apt-get needs to be configured to point to a ppa that will take care of the heavy lifting and then install like anything else via apt.