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
  • 1,479
  • 6
  • 48
  • 89

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,412
  • 27
  • 31
0

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

Rocky Pulley
  • 22,531
  • 20
  • 68
  • 106
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,307
  • 2
  • 38
  • 66