java - Checking if one file is running and another is not -


//credit post of code sourced http://stackoverflow.com/a/37629840 public class applicationutilities {      // http://stackoverflow.com/a/19005828/3764804     private static boolean isprocessrunning(string processname) throws ioexception, interruptedexception {         processbuilder processbuilder = new processbuilder("tasklist.exe");         process process = processbuilder.start();         string taskslist = tostring(process.getinputstream());          return taskslist.contains(processname);     }      // http://stackoverflow.com/a/5445161/3764804     private static string tostring(inputstream inputstream) {         scanner scanner = new scanner(inputstream, "utf-8").usedelimiter("\\a");         string string = scanner.hasnext() ? scanner.next() : "";         scanner.close();          return string;     } } 

this code working me last night while trying add while loop isprocessrunning piece of code return value false. there doing wrong on end these specific programs returning true value running before added while loop in portion of program.

nevermind realised writing wrong program wrong variable , keeping program same (it not running) , changing other variable programs running returning false because program indeed not running


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -