To install the latest version of Oracle Java 7 on Ubuntu Linux, follow these steps:
sudo add-apt-repository ppa:webupd8team/javaSource:tual.wwwturi.com
sudo apt update
sudo apt install oracle-java7-installer
java -version
This should output the version of Java that you have installed, similar to the following:
java version "1.7.0_XX" Java(TM) SE Runtime Environment (build 1.7.0_XX-bXX) Java HotSpot(TM) 64-Bit Server VM (build XX, mixed mode)
Note: Replace XX with the version numbers of the Java installation that you have.
sudo apt install oracle-java7-set-default
This will automatically set Oracle Java 7 as the default Java version when you install it.