Calling ant file through java code [duplicate]
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.
精彩评论