I'm trying to build Java 8 project with Gradle 1.6, but I'm stuck on this error:
Execution failed for task ':ejb:compileJava'
invalid target release: 1.8
JAVA_HOME is set as "D:\Program Files\Java\jdk1.8.0", and build.gradle contains these lines:
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
A Java version between 8 and 18 is required to execute Gradle.
If you're building your app using Android Gradle plugin 4.0. 0 or higher, the plugin extends support for using a number of Java 8 language APIs without requiring a minimum API level for your app.
The class files created by Java 8 are still executable in Java 11; however, there have been other changes in the Java runtime (library changes, etc.) that might require modification of the code. These modifications may be made in Java 8 and compiled with Java 8 making it compatible with the Java 11 runtime.
Compiling and testing Java 6/7Gradle can only run on Java version 8 or higher. Gradle still supports compiling, testing, generating Javadoc and executing applications for Java 6 and Java 7. Java 5 and below are not supported.
Found the answer. I replaced JAVA_HOME
D:\Program Files\Java\jdk1.8.0
with
D:\Progra~2\Java\jdk1.8.0
and build succeeded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With