# Gradle fails to work with JDK9

**URL:** <https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193>\
**Category:** Bugs\
**Tags:** gradle-3286, issue-acknowledged\
**Created:** [April 18, 2015, 6:10pm UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193 "2015-04-18T18:10:07Z")\
**Posts on this page:** 10\
**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 18, 2015, 6:10pm UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/1 "2015-04-18T18:10:07Z")

</div>

Gradle fails to work with JDK9. The issue is the MaxPermSize option which is ignored by JDK8 but is not accepted by JDK9. How to switch off this option when running gradle or gradlew?

## Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at [http://gradle.org/docs/2.3/userguide/gradle\_daemon.html](http://gradle.org/docs/2.3/userguide/gradle_daemon.html) Please read the following process output to find out more:

Unrecognized VM option 'MaxPermSize=384m’  
Error: Could not create the Java Virtual Machine.  
Error: A fatal exception has occurred. Program will exit.

---

<div class="post-metadata">

**Author:** ![sterling](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/sterling/32/5395_2.png) [@sterling](https://discuss.gradle.org/u/sterling)\
**Post date:** [April 19, 2015, 11:02pm UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/2 "2015-04-19T23:02:38Z")

</div>

I think we have some other issues with JDK9 at this time too: [ClassCastException from org.gradle.process.internal.child.BootstrapSecurityManager](https://discuss.gradle.org/t/classcastexception-from-org-gradle-process-internal-child-bootstrapsecuritymanager/2443)

Have you tried with --no-daemon?

---

<div class="post-metadata">

**Author:** ![sterling](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/sterling/32/5395_2.png) [@sterling](https://discuss.gradle.org/u/sterling)\
**Post date:** [April 20, 2015, 2:27am UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/3 "2015-04-20T02:27:46Z")

</div>

I raised GRADLE-3286

---

<div class="post-metadata">

**Author:** ![CedricChampeau](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/cedricchampeau/32/7541_2.png) [@CedricChampeau](https://discuss.gradle.org/u/CedricChampeau)\
**Post date:** [April 20, 2015, 7:17am UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/4 "2015-04-20T07:17:53Z")

</div>

Hi Russel,

I had a similar problem with the Groovy build, which is ran against multiple JDKs (5 to 9), and some of them require the MaxPermSize value and some other not. In the end, what I did is pretty simple: the options are specified in gradle.properties

> <https://github.com/melix/groovy-core/blob/master/gradle.properties#L17-16>

Then when a JDK 9 build is started, before running Gradle, there’s a build step which filters out the MaxPermSize parameter from this line. From my perspective, it means that just having a gradle.properties file that sets org.gradle.jvmargs without MaxPermSize is enough,

---

<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 20, 2015, 11:38am UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/5 "2015-04-20T11:38:47Z")

</div>

OK, so putting:

org.gradle.jvmargs =

in ~/gradle/gradle.properties gets rid of the problem, so I am OK. On the other hand this is getting rid of all the mx options as well. For JDK8 onwards CMS options are a waste of time (due to G1), but if Gradle needs values for mx, ms, etc. I am not getting them.

---

<div class="post-metadata">

**Author:** ![CedricChampeau](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/cedricchampeau/32/7541_2.png) [@CedricChampeau](https://discuss.gradle.org/u/CedricChampeau)\
**Post date:** [April 20, 2015, 11:50am UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/6 "2015-04-20T11:50:24Z")

</div>

As far as I know you can still put Xmx/Xms in the jvmargs. Only make sure you don’t add MaxPermSize.

---

<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 20, 2015, 12:37pm UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/7 "2015-04-20T12:37:29Z")

</div>

Indeed, the question was really what are the right values, or whether the defaults for the JVM are now entirely reasonable given we are talking of JDK8 and JDK9.

---

<div class="post-metadata">

**Author:** ![gverwers](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@gverwers](https://discuss.gradle.org/u/gverwers)\
**Post date:** [April 20, 2015, 1:05pm UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/8 "2015-04-20T13:05:22Z")

</div>

According to [Where Has the Java PermGen Gone?](http://www.infoq.com/articles/Java-PERMGEN-Removed)

MaxPerGen is no more after Java 8 but it was replaced.

It may be useful to look at setting it’s replacement MetaspaceSize.

---

<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 20, 2015, 2:54pm UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/9 "2015-04-20T14:54:15Z")

</div>

That link results in a 404. Yes PermGen is gone from JDK8 onwards, but I think the idea is to leave G1 to sort things out and avoid any setting of JVM parameters unless absolutely necessary.

---

<div class="post-metadata">

**Author:** ![Adrian\_Kelly](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/adrian_kelly/32/106_2.png) [@Adrian\_Kelly](https://discuss.gradle.org/u/Adrian_Kelly)\
**Post date:** [May 12, 2015, 12:44pm UTC](https://discuss.gradle.org/t/gradle-fails-to-work-with-jdk9/9193/10 "2015-05-12T12:44:41Z")

</div>

There is also a ‘+IgnoreUnrecognizedVMOptions’ vm argument:

```gradle
-Dorg.gradle.jvmargs=-XX:+IgnoreUnrecognizedVMOptions

```
