Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build with Java 8

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
like image 953
perak Avatar asked Jul 24 '13 18:07

perak


People also ask

Does Gradle work with Java 8?

A Java version between 8 and 18 is required to execute Gradle.

Which Gradle version is compatible with Java 8?

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.

Can I compile Java 8 with Java 11?

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.

Does Gradle 7 work with java8?

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.


1 Answers

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.

like image 164
perak Avatar answered Oct 11 '22 03:10

perak