I have a command that I need to run in java along these lines:
C:pathhat hasspacesplink -arg1 foo -arg2 bar "path/on/remote/machine/iperf -arg3 hello -arg4 world"
This command works fine when the path has no spaces, but when I have the spaces I cannot seems to get it to work. I have tried the following things, running Java 1.7
String[] a = "C:pathhat hasspacesplink", "-arg1 foo", "-arg2 bar", "path/on/remote/machine/iperf -arg3 hello -arg4 world"
Runtime.getRuntime().exec(a);
as well as
String[] a = "C:pathhat hasspacesplink", "-arg1 foo", "-arg2 bar", "path/on/remote/machine/iperf", "-arg3 hello", "-arg4 world"
Runtime.getRuntime().exec(a);
But neither seem to be doing anything. Any thoughts on what i am doing wrong??
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…