private static File getToolsJar() {
        String javaHome = System.getProperty("java.home");
        File file = new File(javaHome, "../lib/tools.jar");
        if (!file.exists()) {
            file = new File(javaHome, "lib/tools.jar");
            if (!file.exists()) {
                return null;
            }
        }

        return file;
    }
private static File getToolsJar ( ) { String javaHome = System . getProperty ( "java.home" ) ; File file = new File ( javaHome , "../lib/tools.jar" ) ; if ( ! file . exists ( ) ) { file = new File ( javaHome , "lib/tools.jar" ) ; if ( ! file . exists ( ) ) { return null ; } } return file ; }
Gets tools.jar from the JDK, or null if not found (for example, when
running with a JRE rather than a JDK, or when running on Mac).