How to use Java8 in a python/non-java project on Xenial?

We are trying to upgrade the travis configuration for https://github.com/dpkp/kafka-python to Xenial, but have not been successful so far. This is a python client project that tests against a java backend service (kafka). Some of the kafka versions we test against are quite old and require java 8 / will not work on java 11.

Any tips to get opendjk or oracle java installed? the simple ‘jdk:’ directive seems to be ignored because we are a non-java project. Trying to install oracle-java8-set-default via apt-get fails (untrusted 3rd party apt-get sources?).

Any tips?

I just came across the same issue while testing pyspark (requiring Java 8) in combination with python 3.7 (which forced me to upgrade to Xenial). I found a snippet (unfortunately I can’t find the source anymore :frowning:) which successfully installs Java 8 on Xenial.

Here is the link to the bash script. For my needs it was enough to adjust JAVA_HOME accordingly to point to Java 8.