# How to create JDK9 application builds?

**URL:** <https://discuss.gradle.org/t/how-to-create-jdk9-application-builds/22346>\
**Category:** Help/Discuss\
**Created:** [April 15, 2017, 8:12am UTC](https://discuss.gradle.org/t/how-to-create-jdk9-application-builds/22346 "2017-04-15T08:12:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russel\_Winder](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/russel_winder/32/367_2.png) [@Russel\_Winder](https://discuss.gradle.org/u/Russel_Winder)\
**Post date:** [April 15, 2017, 8:12am UTC](https://discuss.gradle.org/t/how-to-create-jdk9-application-builds/22346/1 "2017-04-15T08:12:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jjustinic](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jjustinic/32/9005_2.png) [@jjustinic](https://discuss.gradle.org/u/jjustinic)\
**Post date:** [April 16, 2017, 1:57am UTC](https://discuss.gradle.org/t/how-to-create-jdk9-application-builds/22346/2 "2017-04-16T01:57:53Z")

</div>

There is a section in the user guide on [Java Cross Compilation](https://docs.gradle.org/current/userguide/java_plugin.html#sec: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.

---

<div class="post-metadata">

**Author:** ![Russel\_Winder](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/russel_winder/32/367_2.png) [@Russel\_Winder](https://discuss.gradle.org/u/Russel_Winder)\
**Post date:** [April 16, 2017, 5:35am UTC](https://discuss.gradle.org/t/how-to-create-jdk9-application-builds/22346/3 "2017-04-16T05:35:10Z")

</div>

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” 🙂

I would have thought the compatibility line would be:

set sourceCompatibility = 9

---

<div class="post-metadata">

**Author:** ![sdfelts](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@sdfelts](https://discuss.gradle.org/u/sdfelts)\
**Post date:** [April 22, 2017, 2:31am UTC](https://discuss.gradle.org/t/how-to-create-jdk9-application-builds/22346/4 "2017-04-22T02:31:07Z")

</div>

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](https://github.com/gradle/gradle/issues/1461) for more details.
