Fixing `Could not determine java version from '11.0.5'.`
I was trying to run a Java application when I got this error:
# ./gradlew run
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '11.0.5'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
root@ubuntu-512mb-sfo1-01:~/KOMORANRestAPIServer# cat build.gradle
Posts on StackOverflow suggest many things like updating Gradle with this command ./gradlew wrapper --gradle-version 6.0.1
. But running it gives the same error:
# ./gradlew wrapper --gradle-version 6.0.1
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '11.0.5'.
I had to manually change the version in gradle/wrapper/gradle-wrapper.properties
. Once I did, Gradle ran correctly:
# ./gradlew run
Downloading https://services.gradle.org/distributions/gradle-6.0.1-bin.zip
...........................................................................................................................................................................................................................................................
Unzipping /root/.gradle/wrapper/dists/gradle-6.0.1-bin/1lxlpkiy24sb18odw96cp4ojv/gradle-6.0.1-bin.zip to /root/.gradle/wrapper/dists/gradle-6.0.1-bin/1lxlpkiy24sb18odw96cp4ojv
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-6.0.1-bin/1lxlpkiy24sb18odw96cp4ojv/gradle-6.0.1/bin/gradle
Welcome to Gradle 6.0.1!
Here are the highlights of this release:
- Substantial improvements in dependency management, including
- Publishing Gradle Module Metadata in addition to pom.xml
- Advanced control of transitive versions
- Support for optional features and dependencies
- Rules to tweak published metadata
- Support for Java 13
- Faster incremental Java and Groovy compilation
- New Zinc compiler for Scala
- VS2019 support
- Support for Gradle Enterprise plugin 3.0
For more details see https://docs.gradle.org/6.0.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :run
...