3

I created a new root folder & it contains build.gradle with apply plugin ="java" A folder src -> main -> java (contains code) When I run gradle assemble I'm getting this error

Could not create an instance of type com.sun.tools.javac.api.JavacTool.

:compileJava failed

:processResources UP-TO-DATE

Why is my build process not successful?(i'm on ubuntu 16.04)

Community
  • 1
  • 1
Rohan
  • 129
  • 3
  • 7

2 Answers2

5

Switch your build to use Gradle 3.3 quickly by updating your wrapper properties:

./gradlew wrapper --gradle-version=3.3
alexandre-rousseau
  • 2,321
  • 26
  • 33
Jed Lechner
  • 61
  • 1
  • 6
5

For me it was caused because I had multiples Java environments (openjdk-8 & openjdk-9) on my laptop.

So I began to remove one environment:

$ sudo apt-get remove openjdk-9-*

And then I set JAVA_HOME to openjdk-8. Just had

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/

To your .bashrc file (you may need to correct the link according to your system)

And that's it.

alexandre-rousseau
  • 2,321
  • 26
  • 33