Omar_Jandali
Omar_Jandali

Reputation: 565

Gradle: Could not determin java version from 12

I am trying to use gradle to run a local server on my windows machine. I have java version 12 on my local machine

when i run java -version

 java -version
java version "12" 2019-03-19
Java(TM) SE Runtime Environment (build 12+33)
Java HotSpot(TM) 64-Bit Server VM (build 12+33, mixed mode, sharing)

I am trying to run gradle to see what version of gradle i am running and this is what i get.

 gradle bootRun --stacktrace

FAILURE: Build failed with an exception.

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

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

* Exception is:
java.lang.IllegalArgumentException: Could not determine java version from '12'.
        at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:63)
        at org.gradle.api.JavaVersion.current(JavaVersion.java:72)
        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.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        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:567)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gra

dle.launcher.GradleMain.main(GradleMain.java:23)

I am not sure how to fix it. I also added everything to the correct environment variables

enter image description here

enter image description here

Upvotes: 2

Views: 6174

Answers (1)

Louis Jacomet
Louis Jacomet

Reputation: 14500

From your report, your project is using Gradle 2.8 which was released in October 2015.

Because of its age and the need to parse Java version strings, it cannot recognise the version from a Java 12 VM.

You will need to either:

  • Install an older Java version compatible with your build tool and the code it builds,
  • Upgrade your Grade build to a more recent version - Gradle 5.4 includes Java 12 support.
  • Run your build with a compatible Java version and update it to fork tasks that would need to run things with Java 12.

Upvotes: 5

Related Questions