I write some java code in order to execute some external commands in the mac terminal. The original command to run in the terminal is
xpl-sender -c plugwise.basic -m xpl-cmnd command=livepower device=B83229 -w 3
It is really weird because if I use the command string array likes this:
Process ls = Runtime.getRuntime().exec(new String[]{
"/usr/local/bin/xpl-sender",
"-c", "plugwise.basic",
"-m", "xpl-cmnd",
"command=" + command,
"device=" + id});
Without "-w 3", thing works normally but of course it lacks of parameters.
But if i use like this
Process ls = Runtime.getRuntime().exec(new String[]{
"/usr/local/bin/xpl-sender",
"-c", "plugwise.basic",
"-m", "xpl-cmnd",
"command=" + command,
"device=" + id,
"-w 3"});
With "-w 3" at the end, nothing works anymore, the command seems that it isn't executed.
And if I use like this
Process ls = Runtime.getRuntime().exec(new String[]{
"/usr/local/bin/xpl-sender",
"-c", "plugwise.basic",
"-m", "xpl-cmnd",
"command=" + command,
"device=" + id + " -w 3"});
With +" -w 3"at the end, the perl program which is used to executed the command will return
Illegal hexadecimal digit '-' ignored at /Library/Perl/5.12/xPL/Dock/Plugwise.pm line 964.
It seems that the error caused by the space between -w and 3....
Can someone show me what i did wrong here?
Thank you very much.