jenkinsci / lib-file-leak-detector

Java agent that detects file handle leak
http://file-leak-detector.kohsuke.org/
MIT License
241 stars 112 forks source link

Exception in thread "main" java.lang.IllegalStateException: Unable to find tools.jar #26

Open tzachs opened 7 years ago

tzachs commented 7 years ago

On windows, my JDK is installed at C:\Program Files\Java\jdk1.8.0_65. JAVA_HOME is set to that directory.

From the code at we can see that 'locateToolsJar()' is searching in the wrong library. Instead of searching in 'return new File(home,"../lib/tools.jar");' it should be 'return new File(home,"/lib/tools.jar");'

From 'https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html' we can see that java.home is 'Installation directory for Java Runtime Environment (JRE)' and not JDK

sanjaybsm commented 7 years ago

Faced similar issue when I downloaded the jar and try to run.