# Buildship can not find dependency; Gradle can

**URL:** <https://discuss.gradle.org/t/buildship-can-not-find-dependency-gradle-can/16986>\
**Category:** Buildship\
**Tags:** buildship\
**Created:** [April 23, 2016, 8:14pm UTC](https://discuss.gradle.org/t/buildship-can-not-find-dependency-gradle-can/16986 "2016-04-23T20:14:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlb1141](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@mlb1141](https://discuss.gradle.org/u/mlb1141)\
**Post date:** [April 23, 2016, 8:14pm UTC](https://discuss.gradle.org/t/buildship-can-not-find-dependency-gradle-can/16986/1 "2016-04-23T20:14:00Z")

</div>

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

:clean  
:eclipseClasspath  
:eclipseJdt  
:eclipseProject  
:eclipse  
:printDependencies  
**C:\Java\jdk1.8.0\_77\lib\tools.jar**  
C:\Users\Mike.gradle\caches\modules-2\files-2.1\com.microsoft.sqlserver\sqljdbc4\4.2.6420.100\4d8a1bc64ddf2099dbc2a171e113f6654a1c02a6\sqljdbc4-4.2.6420.100.jar  
C:\Users\Mike.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.10\5b338f206827d88acd890739f400a9b7664e5984\slf4j-api-1.7.10.jar  
C:\Users\Mike.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.1.2\b316e9737eea25e9ddd6d88eaeee76878045c6b2\logback-classic-1.1.2.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.

BUILD FAILED

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

Any ideas on what could be my issue?

---

<div class="post-metadata">

**Author:** ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)\
**Post date:** [April 25, 2016, 1:26pm UTC](https://discuss.gradle.org/t/buildship-can-not-find-dependency-gradle-can/16986/2 "2016-04-25T13:26:46Z")

</div>

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/gradle.properties`, set the `org.gradle.java.home` property. This will ensure that Gradle uses this Java installation no matter from where it is started. See the [user guide](https://docs.gradle.org/current/userguide/build_environment.html) for more information

Cheers,  
Stefan
