TL;DR - here
I created a set of scripts (for now just two, they may grow in future if I need something more or if someone else contributes) devoted to work around the continuous issues we are experiencing with downloading JDK versions due to the abuse of the great
As @sormuras suggested in another topic, Jabba could be a more reliable method for installing the JDK. Gravis does so. It works around the Travis Java support (in fact, I recommend using a
language: bash build), installs the JDK selected from the Jabba archive, works around Travis bugs / limitations, and performs the operations.
Instructions are available here, this is the first project where I used it.