Curiously,
does not mention $JAVA_HOME for Linux installation.
We can guess the value based on files at hand, and it would go something like this:
f=$(which javac)
while [[ -L $f ]]; do f=$(readlink $f); done
export JAVA_HOME=${f%/bin/*}
The result is something like this: https://travis-ci.org/BanzaiMan/travis_production_test/builds/641393626#L890
Could you add the snippet above in your build and see if that meets your needs?
Thanks.