Saturday, September 27, 2014
Example 2
public class RunCmd
{
public static void main(String[] args)
{
Process P;
Runtime r;
r = Runtime.getRuntime();
try {
String cmd = new String();
cmd ="C:\\db2sqlloader\\run_dir.bat";
// ;
try {
P = r.exec(cmd);
int Exitcode = P.waitFor();
if (Exitcode != 0)
{
System.out.println("The command line job did not execute successfully");
}
else
{
System.out.println("The command line job - " +
" - executed successfully."); //break
}
}
catch (Exception e)
{
System.out.println(" 1 e.getMessage():"+e.getMessage());
}
} catch (Exception e)
{
System.out.println("2 e.getMessage():"+e.getMessage());
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment