public static boolean checkDot ( ) throws IOException { // call graphviz-dot via commons-exec CommandLine cmdLine = new CommandLine ( DOT_EXE ) ; cmdLine . addArgument ( "-V" ) ; DefaultExecutor executor = new DefaultExecutor ( ) ; executor . setExitValue ( 0 ) ; ExecuteWatchdog watchdog = new ExecuteWatchdog ( 60000 ) ; executor . setWatchdog ( watchdog ) ; executor . setStreamHandler ( new PumpStreamHandler ( System . out , System . err ) ) ; int exitValue = executor . execute ( cmdLine ) ; if ( exitValue != 0 ) { System . err . println ( "Could not run '" + DOT_EXE + "', had exit value: " + exitValue + "!" ) ; return false ; } return true ; }
Verify if dot can be started and print out the version to stdout .