How to create JDK9 application builds?


(Russel Winder) #1

So for now Gradle has to run on JDK8. However I still need to build JDK9 applications using Gradle. Can someone tell the necessary magic to achieve this. Or point me at a page explaining how to do it.


(James Justinic) #2

There is a section in the user guide on Java Cross Compilation. It specifically references Java 6, but the same configuration will work with JDK9 if you set sourceCompatibility = 1.9, at least for the basics.


(Russel Winder) #3

Ah splendid, yes that will work, though maybe too much hassle if Gradle Inc pull their finger out and get Gradle running on JDK9 fairly swiftly. After all the sentence does say “Gradle can only run on Java version 7 or higher” :slight_smile:

I would have thought the compatibility line would be:

set sourceCompatibility = 9


(Steve Felts) #4

You can run Gradle on JDK9.
You need to specify a bunch of --add-opens using the environment variable JDK_JAVA_OPTIONS.
See https://github.com/gradle/gradle/issues/1461 for more details.