# State of Gradle Java 9 Support

DevFeed: [State of Gradle Java 9 Support](<https://devfeed.tech/articles/state-of-gradle-java-9-support-24660.md>)

Original publisher: [Read original article](<https://blog.gradle.org/java-9-support-update>)

Author: Eric Wendelin

Published: 2017-10-17T04:00:00Z

Content type: article

Language: en

Sources: [The Gradle Blog](<https://devfeed.tech/sources/the-gradle-blog.md>)

Topics: [Gradle](<https://devfeed.tech/topics/gradle.md>), [Java](<https://devfeed.tech/topics/java.md>), [Cross-Compilation](<https://devfeed.tech/topics/cross-compilation.md>), [modules](<https://devfeed.tech/topics/modules.md>), [Architecture & Design](<https://devfeed.tech/topics/architecture-design.md>)

Tags: [cross-compilation](<https://devfeed.tech/tags/cross-compilation.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [java](<https://devfeed.tech/tags/java.md>), [java-9](<https://devfeed.tech/tags/java-9.md>), [module](<https://devfeed.tech/tags/module.md>), [security](<https://devfeed.tech/tags/security.md>), [software-architecture](<https://devfeed.tech/tags/software-architecture.md>)

## AI overview

This article explains Gradle's Java 9 support as of Gradle 4.2.1. It covers running and building applications with major JDK 9 distributions, cross-compilation from JDK 9 to JDK 8, limitations around Multi-Release JARs, and using Java 9 modules with Gradle.

## Source excerpt

This post provides an overview of Gradle's Java 9 support, touching on runtime, cross-compilation, MRJARs, and Jigsaw modules support. We've fielded lots of questions since Java 9 was released last month, and decided it best to answer here. What Gradle supports as of version 4.2.1 As of Gradle 4.2.1, building and running Java applications using major distributions of JDK 9 such as Oracle JDK9, OpenJDK9 and Azul JDK9 is fully supported. Further, cross-compilation (built by JDK9 but runs on JDK8) is supported. Some builds will break when upgrading to Java 9, regardless of build tool used. The Java team have made good and necessary changes to the JDK to facilitate better software architecture and security, but this has meant removing access to some APIs. Even if your project is ready, some tools and Gradle plugins have not yet been updated to work with Java 9. There is no convenience methods for consuming and assembling Multi-Release JARs, but you can take a look at this MRJAR-gradle example if you desire to use them. Java Modules aka Jigsaw Support If you're not yet familiar with the Java 9 Platform Module System, also known as Project Jigsaw, you should read Project Jigsaw: Module System Quick-Start Guide. The motivation and terminology are well explained in The State of the Module System. A module is defined as "a named, self-describing collection of code and data" whereby packages are treated as code boundaries, and are explicitly exported and required. Non-exported packages are not visible to module consumers, and further 2 modules cannot export the same packages, nor can they have the same internal packages. This means that packages cannot be "split" or duplicated between multiple modules, or compilation will fail. Here is a guide that shows how to use Java modules with Gradle today. It walks you through the steps necessary to tell Gradle to use the modulepath and not classpath when compiling Java sources and patch modules for testing purposes. A bottom-up approa