I am developing a java application that needs a very recent version of java. Unfortunately travis-ci currently only supports jdk version 1.8.0_31.
Because of that I download the newes binary release from oracle and extract it to the $HOME directory:
before-script:
- "wget --no-cookies --header \"Cookie: oraclelicense=accept-securebackup-cookie\" http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz -O /tmp/OracleJDK.tar.gz"
- tar -xzvf /tmp/OracleJDK.tar.gz -C $HOME
- export PATH=$PATH:$HOME/jdk1.8.0_60/bin
- jdk_switcher use <???>
How do I tell travis to use the freshly downloaded jdk?
BTW: I'm not updating the jdk via apt-get because sudo commands are not supported yet with their new docker infrastructure.
I solved this by using the travis apt addon like this:
jdk:
- oraclejdk8
addons:
apt:
packages:
- oracle-java8-installer
This automatically installs the newest java8 version without using sudo
You might also want to use the oracle-java8-set-default
package:
jdk:
- oraclejdk8
addons:
apt:
packages:
- oracle-java8-installer
- oracle-java8-set-default
That did the trick for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With