Skip to content

Instantly share code, notes, and snippets.

@hayderimran7
Created March 8, 2017 19:53
Show Gist options
  • Save hayderimran7/b24545f33e7ffd5edbfcc386746ffb09 to your computer and use it in GitHub Desktop.
Save hayderimran7/b24545f33e7ffd5edbfcc386746ffb09 to your computer and use it in GitHub Desktop.

How to fix gradle Could not find tools.jar

while building a jenkins plugin , i saw this error on ubuntu:

./gradlew jpi
:localizer UP-TO-DATE
:stapler UP-TO-DATE
: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

Total time: 7.036 secs

to fix this:

  1. Run
 export JAVA_HOME=`jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));'`
  1. Run gradle again
./gradlew jpi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment