Chosen JDK for build is not honoured as javac and java binaries differ in versions

Having a build configured to run with a matrix of JDK versions I’d expect java and javac to be of the same version.

Experiencing build failures in
that seem to be related to the mixup of versions:

$ java -Xmx32m -version
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-8u141-b15-3~14.04-b15)
OpenJDK 64-Bit Server VM (build 25.141-b15, mixed mode)
$ javac -J-Xmx32m -version
javac 9.0.1

A local build with JDK8 does not fail the animal-sniffer/maven-enforcer-plugin run but gives strange errors on Travis.

Is it possible to set/fix the versions via .travis.yml?
Can I launch a test build having the same JDK for java and javac to see if the build problems disappear on Travis?
Apache Software Foundations’s Jenkins (running with a fixed version of Java) does not have these problems:

Any help appreciated :slight_smile:


This bug was reported in 2018. Why has it not been fixed?

JDK version does not match javac version