Ant任务外部程序挂起
我正在从ANT运行mqsicreatbar.exe程序,过了一段时间它就会挂起。 有人能帮忙吗。同样的命令在命令行中也可以正常工作Ant任务外部程序挂起,ant,windows-server-2003,Ant,Windows Server 2003,我正在从ANT运行mqsicreatbar.exe程序,过了一段时间它就会挂起。 有人能帮忙吗。同样的命令在命令行中也可以正常工作 Ant Version: 1.8.2 OS version: Windows Server 2003 这是我发布的代码 protected String runS(Commandline cmdline, String outputProperty) { //String outV = "opts.mb.runS.output" + i
Ant Version: 1.8.2 OS version: Windows Server 2003
这是我发布的代码
protected String runS(Commandline cmdline, String outputProperty) {
//String outV = "opts.mb.runS.output" + i++;
Project aProj = getProject();
ExecTask exe = (ExecTask) aProj.createTask("exec");
Commandline.Argument arg = exe.createArg();
exe.setExecutable(cmdline.getExecutable());
arg.setLine(Commandline.toString(cmdline.getArguments()));
exe.setOutputproperty(outputProperty);
exe.execute();
System.out.println( "runS: " + outputProperty + " : " );
return aProj.getProperty(outputProperty);
}
根据您试图运行的命令(批处理文件等),您需要指定exec任务的“可执行文件”为“cmd.exe”,并将实际可执行文件指定为命令行参数
注意:链接的示例使用
os=“Windows NT”
,仅当操作系统名称为“Windows NT”时才会执行。例如,这不会在“Windows Server 2008 R2”上执行。有关详细信息,请参阅文档。