If you install using oracle-java * -installer, you will be asked for a licensing dialogue during the installation, which you may have experienced.
However, this is inconvenient if you want to proceed with the setup without interaction with a mechanism like CI or Infrastructure as Code.
I tried google, but it took some time to get a hit, so I'll make a note here.
By issuing the following command, you can proceed with the installation by <OK>
the license agreement without any interaction.
$ sudo add-apt-repository -y ppa:webupd8team/java
$ sudo apt-get update
$ echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-$ set-selections
$ echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
$ # sudo apt-get -y install oracle-java7-installer
$ sudo apt-get -y install oracle-java8-installer
Below are the Stackoverflow topics we arrived at. https://stackoverflow.com/questions/19275856/auto-yes-to-the-license-agreement-on-sudo-apt-get-y-install-oracle-java7-instal
In addition, let's confirm the license permission for the skipped dialogue separately. http://www.oracle.com/technetwork/jp/licenses/javase-dev-license-2595998-ja.html