Buildship can not find dependency; Gradle can

I have buildship 1.0.12 installed in eclipse. When I run the build.gradle from a windows command prompt, it completes successfully. When I try to run it by highlighting my build.gradle and using “run configurations” it fails because it says it cannot find tools.jar. Prior to running the jar task I print the dependencies and it shows the tools.jar file.

Gradle User Home: C:\Users\Mike.gradle
Gradle Distribution: Gradle wrapper from target build
Gradle Version: 2.12
Java Home: C:\Java
JVM Arguments: None
Program Arguments: None
Gradle Tasks: clean eclipse printDependencies jar

. . . .
:compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileJava’.

Could not find tools.jar

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


tools.jar IS located in C:\Java\jdk1.8.0_77\lib

Any ideas on what could be my issue?

Hi Mike,

the tools.jar does not belong on your dependency list. It is not one of your dependencies, it is the compiler.

You are probably running Eclipse with a JRE instead of a JDK. Buildship starts Gradle with the same runtime that Eclipse uses by default. There are several solutions you can go for, but the simplest is this one:

In your ~/.gradle/, set the property. This will ensure that Gradle uses this Java installation no matter from where it is started. See the user guide for more information