18

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
perak
  • 1,310
  • 5
  • 20
  • 31

2 Answers2

5

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.

perak
  • 1,310
  • 5
  • 20
  • 31
  • 10
    Was your filesystem FAT32? Can't believe that I am seeing "Progra~1" in 2013. – lyomi Dec 17 '13 at 10:24
  • 2
    My filesystem is ntfs – perak Jan 11 '14 at 18:07
  • @perak I'm using this "C:\Program Files\Java\jdk1.8.0_45" Or even this "C:\Program Files (x86)\Java\jdk1.8.0_45" in JAVA_HOME, in both User variables and System variable in Environment Variables, But problem is still exist! – Dr.jacky May 16 '16 at 07:46
  • I am also facing the same problem. The JAVA_HOME is set to C:\Program Files\Java\jdk1.8.0_31 but still getting the error . Any solution? – worrynerd May 26 '17 at 21:27
0

I found picking wrong JAVA_HOME path value. After updating correct path, it's working for me. No need to do any change.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Jagdeep
  • 21
  • 5