Java on Linux: How to install and enable Oracle’s Java instead of OpenJDK

Many of the major Linux distributions come bundled with OpenJDK Java instead of the “standard” Sun Java or — since Sun Microsystems acquisition by Oracle in 2010 — Oracle Java. One such distro is Fedora, for example.

Open JDK is ok in most cases but there are situations where you need to install the “real” Java on your computer and/or be able switch between them.