开发者

Calling ant file through java code [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Duplicate:

Is it possible to call Ant or NSIS scripts from Java code?

I need to call an ant build in java code. I try to use Runtime class. I dont know how to give the ant build to the following code. I tried to assign the entire ant script to a string, it wont work. Any suggest开发者_如何学Goion

Process child = Runtime.getRuntime().exec("command");


This question should help you:

Is it possible to call Ant or NSIS scripts from Java code?

And this one has a good link in the accepted answer explaining running commands from java in general: Collect Linux command output


Try "cmd /c ant build", that should work.


Alternatively use Gant which is nothing else than using Groovy for scripting Ant scripts instead of using xml.
Groovy scripts compile to Java bytecode - pure Java.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜