private static String findGnuplotHelperScript ( ) { if ( ! GnuplotInstaller . FOUND_GP ) { LOG . warn ( "Skipping Gnuplot Shell Script Install since Gnuplot executable was not found" ) ; return null ; } if ( ! GnuplotInstaller . GP_FILE . exists ( ) ) { GnuplotInstaller . installMyGnuPlot ( ) ; } if ( GnuplotInstaller . GP_FILE . exists ( ) && GnuplotInstaller . GP_FILE . canExecute ( ) ) { LOG . info ( "Auto Installed Gnuplot Invoker at [{}]" , GnuplotInstaller . GP_FILE . getAbsolutePath ( ) ) ; return GnuplotInstaller . GP_FILE . getAbsolutePath ( ) ; } final URL url = GraphHandler . class . getClassLoader ( ) . getResource ( WRAPPER ) ; if ( url == null ) { throw new RuntimeException ( "Couldn't find " + WRAPPER + " on the" + " CLASSPATH: " + System . getProperty ( "java.class.path" ) ) ; } final String path = url . getFile ( ) ; LOG . debug ( "Using Gnuplot wrapper at {}" , path ) ; final File file = new File ( path ) ; final String error ; if ( ! file . exists ( ) ) { error = "non-existent" ; } else if ( ! file . canExecute ( ) ) { error = "non-executable" ; } else if ( ! file . canRead ( ) ) { error = "unreadable" ; } else { return path ; } throw new RuntimeException ( "The " + WRAPPER + " found on the" + " CLASSPATH (" + path + ") is a " + error + " file... WTF?" + " CLASSPATH=" + System . getProperty ( "java.class.path" ) ) ; }
Iterate through the class path and look for the Gnuplot helper script .