Could not determine java version from '9.0.1'

Using Gradle 4.1 and jdk-9.0.1_windows-x64_bin.exe from http://download.oracle.com/otn-pub/java/jdk/9.0.1+11 leads to the following error:

  • What went wrong:
    Could not determine java version from ‘9.0.1’.

See log at https://ci.appveyor.com/project/marcphilipp/junit5/build/1924

Would an upgrade to Gradle 4.3 solve this issue? ( And introduce another one: https://github.com/ajoberstar/gradle-git-publish/issues/35 )

Yes, upgrading to Gradle 4.3-rc-2 helped.

https://ci.appveyor.com/project/marcphilipp/junit5/build/1927

Please use 4.2.1, the problem has been fixed there.

I’m using 4.2.1 and I’m still experiencing this issue.

1 Like

@codeblooded It should work. Could you provide a little bit more information about the failure you are seeing? A stacktrace or a build scan would be great!

Thanks,
Stefan

I’m hitting this issue too.

my gradlew stacktrace looks like this :
java.lang.IllegalArgumentException: Could not determine java version from ‘9.0.1’.
at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:68)
at org.gradle.api.JavaVersion.current(JavaVersion.java:78)
at org.gradle.internal.jvm.UnsupportedJavaRuntimeException.assertUsingVersion(UnsupportedJavaRuntimeException.java:29)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:32)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

fixed it. Had to change project settings to point to correct version of Gradle

1 Like

Hi, how did you solve it please ? I have the exact same error with gradle 4.2.1 when I run gradlew build in spring project folder…

build.gradle of spring :

buildscript {
	ext {
		springBootVersion = '1.5.8.RELEASE'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
	}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
	mavenCentral()
}


dependencies {
	compile('org.springframework.boot:spring-boot-starter')
	compile('org.springframework.boot:spring-boot-starter-web')
	compile('org.springframework.boot:spring-boot-devtools')
	testCompile('org.springframework.boot:spring-boot-starter-test')
}

I solved it by upgrading to 4.3… :slight_smile:

upgrading gradle ? how please ? ^^’

See https://gradle.org/install/

Thanks but 4.3, released on 30 Oct 2017… How did people do 3 days ago ? :joy:

Please help @RichLinnell

It doesn’t work…

C:\Users\theo1\Desktop\FirstSpringProject>gradle -v
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/C:/Gradle/gradle-4.3/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

------------------------------------------------------------
Gradle 4.3
------------------------------------------------------------

Build time:   2017-10-30 15:43:29 UTC
Revision:     c684c202534c4138b51033b52d871939b8d38d72

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          9.0.1 (Oracle Corporation 9.0.1+11)
OS:           Windows 10 10.0 amd64

C:\Users\theo1\Desktop\FirstSpringProject>gradlew build --stacktrace

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.1'.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
java.lang.IllegalArgumentException: Could not determine java version from '9.0.1'.
        at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:70)
        at org.gradle.api.JavaVersion.current(JavaVersion.java:80)
        at org.gradle.internal.jvm.UnsupportedJavaRuntimeException.assertUsingVersion(UnsupportedJavaRuntimeException.java:29)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:32)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:247)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:182)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:31)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)


C:\Users\theo1\Desktop\FirstSpringProject>

First run gradlew --version and then read https://gradle.org/install/#with-the-gradle-wrapper

I fixed it by changing distributionUrl in the file [project]\gradle\wrapper\gradle-wrapper.properties to point to disribution of version 4.3. (Bottom line.)

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.3-src.zip
1 Like

I cannot run gradlew --version same error

C:\Users\theo1\Desktop\FirstSpringProject>gradlew --version --stacktrace

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.1'.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
java.lang.IllegalArgumentException: Could not determine java version from '9.0.1'.
        at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:70)
        at org.gradle.api.JavaVersion.current(JavaVersion.java:80)
        at org.gradle.internal.jvm.UnsupportedJavaRuntimeException.assertUsingVersion(UnsupportedJavaRuntimeException.java:29)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:32)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:247)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:182)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:31)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

:star_struck::star_struck::star_struck:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-src.zip

after checkiong version it dowloaded something then

Exception in thread "main" java.lang.NullPointerException
        at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:38)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:26)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

And then

C:\Users\theo1\Desktop\FirstSpringProject>gradlew --version

C:\Users\theo1\Desktop\FirstSpringProject>gradlew build
Exception in thread "main" java.lang.NullPointerException
        at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:38)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:26)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

You need to make sure you updated the wrapper jar and the version of Gradle you want to run to at least 4.2.1.
This means that you also need to run the wrapper task with a Gradle version >= 4.2.1 or run the wrapper task twice:

./gradlew wrapper --gradle-version 4.2.1 --no-daemon
./gradlew wrapper --gradle-version 4.2.1 --no-daemon

Note that I added the --no-daemon flag since the daemon won’t help much given that it will be used only once for each wrapper invocation.

Thanks but I have this :disappointed_relieved:

C:\Users\theo1\Desktop\FirstSpringProject>gradlew wrapper --gradle-version 4.2.1 --no-daemon
Exception in thread "main" java.lang.NullPointerException
        at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:38)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:26)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

@to175 You cannot use the src distribution to run Gradle. Please use -bin or -all, e.g. in your gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip

Sorry I don’t understand can you be more specific please, what can I do concretly ?