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
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.
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
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,
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.