batch file - Execute a set of commands through java -
this question has reply here:
how run batch file java application? 8 answersi have set of commands executing through java. stored them in .bat file , executing through java. when run bat file through command prompt executes when execute through java, 1-2 commands execute , programme exits. please suggest me solution this.
please suggest me jar file if other command referenced
code:
public static string cmdexec(string cmd) throws ioexception { process p = runtime.getruntime().exec(cmd); }
the basic form executing should be;
public static string cmdexec(string cmd) throws ioexception { process p = runtime.getruntime().exec(cmd); p-waitfor(); }
there several circumstances may impact execution of command if 1 not wait completion.
only if parent process (i.e. java program) continues, no other exec might interfere exec started, no resource required exec affected, omit waitfor more efficiency (by parallel execution).
java batch-file cmd threadpool
No comments:
Post a Comment