Java Service to run a cmd line

Does anybody has a Java service doing a cmd Line (Like ls or any kind of cmd line)

This is the example in 4.6 WmSamples package. Remember a service like this can cause opportunity for misuse, so keep an ACL on it and if possible hardcode a single specific command line.

public static final void fireCommandExec (IData pipeline)
throws ServiceException
{
// — <<B2B-START(fireCommandExec)>> —
// @sigtype java 3.5
// [i] field:0:required fullCommand
// [o] field:0:required successFlag
//define input variables
IDataCursor idcPipeline = pipeline.getCursor();
String strFileContent = null;

//Output Variables
String successFlag = “false”;
String fullCommand ;

// Check to see if the fullCommand object is in the pipeline
if (idcPipeline.first(“fullCommand”))
{
//get the fullCommand stream out of the pipeline
fullCommand = (String) idcPipeline.getValue();
}
//if it is not in the pipeline, then handle the error
else {
util.Log.log(“Error executing sample.io.commandLineExec.fileCommandExec: Required parameter ‘fullCommand’ missing.”, “sample.commandLineExec”);
return;
}

//Run the command
String execFile = (String) idcPipeline.getValue() ;

//Execute the command. Handle the exception if it fails.
try {
Process child = Runtime.getRuntime().exec(execFile);
successFlag=“true”;
}
catch (IOException e) {
//Write the error to server.log
util.Log.log("Error executing sample.io.commandLineExec.fileCommandExec: " + e.toString(), “sample.commandLineExec”);
successFlag=“false”;
}

//insert the successFlag into the pipeline
idcPipeline.insertAfter(“successFlag”, successFlag);

//Always destroy cursors that you created
idcPipeline.destroy();
// — <> —
}

Hi,

I tried running cmd but it doesn’t pop up or proceed any further commands that I would do on a cmd window. Any Views ??