Execute JUnit tests with a specific JVM

would need to run gradle(latest version: 6.0.1) with Java JDK 8 and run the unit tests of the projects with another JVM (Java 6), is that possible ? How can I achieve that ?

I was able to achieve what I wanted with the help of an ant task and forking its runner, more information in this other post that I’ve opened because now I have a warning about conflicting ant versions.

I think you can set the executable property on the test task.


apply plugin: 'java' 
test {
   executable = 'path/to/jre/bin/java.exe'

see the following link, it explain how to do it.