processbuilder - unable to open exe application using java -
i'm trying open prom (process mining tool) using java. doesn't have effect @ all.
try { new processbuilder("c:\\program files\\prom\\prom.exe").start() ; } catch (exception e) { system.out.println(e); e.printstacktrace(); }
this code doesn't have effect.
but when open uninst.exe in same folder same code, works perfectly
try { new processbuilder("c:\\program files\\prom\\uninst.exe").start() ; } catch (exception e) { system.out.println(e); e.printstacktrace(); }
i don't know why happen. there solution? did java unable load heavy application?
you should check program output via process.getinputstream()
, process.geterrorstream()
, program issuing warning or error messages, don't lead exception. these errors or warnings missing paths, environment variables, permissions on files , folders, or missing arguments.
process proc = new processbuilder( "c:\\program files\\prom\\prom.exe").start() ; bufferedreader stdinput = new bufferedreader(new inputstreamreader(proc.getinputstream())); bufferedreader stderror = new bufferedreader(new inputstreamreader(proc.geterrorstream())); // read output command system.out.println("here standard output of command:\n"); while ((s = stdinput.readline()) != null) { system.out.println(s); } // read errors attempted command system.out.println("here standard error of command (if any):\n"); while ((s = stderror.readline()) != null) { system.out.println(s); }
also check return code of process, using process.exitvalue()
. convention, 0 means went ok.
Comments
Post a Comment