Trouble with Gradle and Junit

I wanted to get started but I’m having trouble combining kotlin with gradle and Junit.

For all of these repositories, ‘gradle build’ gives an error:

Given that all these are failing, I’m guessing something is wrong with my installation.
I am using:

  • “kotlin -version” → “Kotlin version 1.2.21-release-88 (JRE 9.0.4+11)”
  • “gradle --version” → “Gradle 4.5… 9.0.4”
  • “java -version” → “openjdk version “9-internal””
  • “javac -version” → “javac 9-internal”
  • ubuntu 16.04

Could someone try to run one of these repos, and if it works, what their setup is.

Please install Oracle JDK 8. I’m not sure what exactly the “9-internal” version of OpenJDK is, but obviously it doesn’t work properly.

I believe OpenJDK ‘9-internal’ is what newer versions of Ubuntu install if you run this command:

sudo apt-get install default-jdk

The errors are most likely the result of missing module exports.
For instance java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessor can be fixed if java is run with the following switch:
--add-exports java.base/sun.reflect=ALL-UNNAMED

Determining which module exports are missing and adding appropriate switches is somewhat time consuming so I would recommend installing Java 8 and setting it up as default as the best solution to your issues - exactly like @yole said :slight_smile: