2011-05-16 91 views
0

我正在運行ANT的mqsicreatbar.exe程序,並在某個時間後掛起。 有人可以提供任何幫助。同樣的命令工作在命令行精細Ant任務外部程序掛起

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); 
    } 

回答

0

根據您正在嘗試運行(批處理文件等),你做的命令需要指定exec任務的「可執行文件」是「cmd.exe」,並將您的實際可執行文件指定爲命令行參數。

http://ant.apache.org/faq.html#batch-shell-execute

+0

注:鏈接的例子使用'OS = 「Windows NT的」'這將只執行如果操作系統名爲 「Windows NT的」。例如,這不會在「Windows Server 2008 R2」上執行。有關詳細信息,請參閱[執行任務](https://ant.apache.org/manual/Tasks/exec.html)文檔。 – 2014-01-31 16:06:11