Rohan
Rohan

Reputation: 127

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

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)

Upvotes: 3

Views: 5615

Answers (2)

Jed Lechner
Jed Lechner

Reputation: 61

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

./gradlew wrapper --gradle-version=3.3

Upvotes: 5

alexandre-rousseau
alexandre-rousseau

Reputation: 2840

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.

Upvotes: 5

Related Questions