Jeremy Stein - Brain

« »

How to call a system command from Javascript

This will not work from a browser. This works with LiveConnect to do server-side scripting for applications that support it (like IBM Tivoli Directory Integrator).

var runtime = java.lang.Runtime.getRuntime();
var process = runtime.exec(command);
process.waitFor();
var exitValue = process.exitValue();
if (exitValue == 0)

Ideally, you should pass the command as an array. Also, you should handle the streams.

May 20, 2005 No Comments.

No Comments

Be the first to comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

Why ask?

« »