Mykhaylo Adamovych
Mykhaylo Adamovych

Reputation: 20966

Execute JavaScript (HTML) file by ant and redirect output to file

How to execute JavaScript file by ant and redirect stdout and stderr to files?
For example let say we have

helloWorld.js

console.log('Hello world!');  

I need ant target to proudce

stdout.txt

Hello world!

It is acceptable to create temporary HTML file that include needed JavaScript file and then execute tmp.html, but I would like to omit this step if possible.

Upvotes: 2

Views: 554

Answers (2)

nrabinowitz
nrabinowitz

Reputation: 55678

You can use Rhino to execute Javascript from ant. See this question or any of these questions for examples.

Upvotes: 1

Jason Miesionczek
Jason Miesionczek

Reputation: 14448

Node.js would help with this. No HTML necessary.

Upvotes: 1

Related Questions