Oracle Java isn’t pre-installed in Ubuntu. The installation tutorial in Oracle website is quite confusing. Even though there is a ppa which is supposed to install it without much of a hassle, not all distros support ppa.
The script is meant to work in machines without any version of Java installed.
So, if you need to install it and can’t use a ppa, you may find this script useful.