0

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 suggestion

Process child = Runtime.getRuntime().exec("command");
Community
  • 1
  • 1
Manikandan
  • 2,463
  • 5
  • 51
  • 91

3 Answers3

3

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

Community
  • 1
  • 1
Nick DeFazio
  • 2,342
  • 27
  • 31
0

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

Rocky Pulley
  • 21,409
  • 19
  • 65
  • 104
0

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.

Rebse
  • 10,227
  • 2
  • 33
  • 64