1

I tried

val cmd = sys.process.Process(Seq("C:\apache-ant-1.9.3\bin\ant", "everythingNoJunit"), new java.io.File(scriptDir))

cmd.lines

and got this error:

CreateProcess error=193, %1 is not a valid Win32 application

How do I run the ant script from within scala app?

Community
  • 1
  • 1
s.t.nguyen
  • 74
  • 6
  • Can you run ANY command? If you start with something simple, such as the examples in the documentation, you can then mutate it step by step into what you want. – Bob Dalgleish Apr 16 '14 at 15:27

1 Answers1

1

The basic answer is that your should be using "ant.bat" instead of "ant" on a windows machine as in this answer

In addition to that, I would suggest using a non-windows styled path so you don't have to escape the backslashes:

val cmd = sys.process.Process(Seq("/apache-ant-1.9.3/bin/ant.bat", "everythingNoJunit"), new java.io.File(scriptDir))

Using this approach, I'm able to run an an ant target successfully when my scala application is also in "c:".

Community
  • 1
  • 1
n0741337
  • 2,474
  • 2
  • 15
  • 15