vbscript - Not able to execute/run vbs file from java on server -
i have vbs file xxx.vbs i'm able execute on local machine using below code:
string cmd = "wscript filepath\\xxx.vbs"; process p = runtime.getruntime().exec(cmd);
but when create war file of project , deploy on server, i'm not able execute vbs file.
i can execute vbs file manually on server. there nothing wrong vbs file.
any idea on may reason above?
try adding below snippet determine whats happening in background.
string line=""; try { inputstreamreader isr = process.getinputstream(); bufferedreader br = new bufferedreader(isr,4094); while ( (line = br.readline()) != null) system.out.println(line); } catch (ioexception ioe) { ioe.printstacktrace(); } try { isr = process.geterrorstream(); br = new bufferedreader(isr,4094); while ( (line = br.readline()) != null) system.out.println(line); } catch (ioexception ioe) { ioe.printstacktrace(); }
p.s. above snippet informational purpose.
runtime.getruntime().exec()
begin execution, , exits.. trying above show exceptions, if any, , output of script file trying run.
however, better way create seperate runnable can accept input stream , display content instead of writing code specified above.
Comments
Post a Comment