gradle could not determine java version

‮/:sptth‬/www.lautturi.com
gradle could not determine java version

If you are getting the error "Could not determine Java version using executable" when running a Gradle build, it means that Gradle is unable to find the Java executable on your system. This can be caused by several factors:

  1. The Java executable is not in your system's PATH. To fix this, you can add the directory containing the java executable to your PATH environment variable.

  2. The JAVA_HOME environment variable is not set correctly. This variable should be set to the directory where the Java runtime is installed on your system. You can check the value of this variable by running the following command:

echo $JAVA_HOME
  1. You have multiple versions of Java installed on your system, and the version that Gradle is trying to use is not the correct one. In this case, you can specify the Java version that you want to use in your Gradle build file.

To specify the Java version in your Gradle build file, you can use the sourceCompatibility and targetCompatibility properties in the java block:

java {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

This will tell Gradle to use Java 8 for both the source and the target compatibility.

If none of these solutions solve the problem, you may need to check your system's configuration to ensure that Java is properly installed and configured. You can also try re-installing Java to see if that resolves the issue.

Created Time:2017-11-01 12:05:02  Author:lautturi