Spaces in Java file path to an executable -
ok, know noobish question, i'm pretty new java, , it'll easy answer. i'm trying make program use file path open firefox, seems there problem file path. did research , used double slash nullify escape characters, still doesn't work. think has fact there spaces in of directories' names. here code:
import java.io.ioexception; public class automation { public static void main(string[] args) throws ioexception { process p = runtime.getruntime().exec("c:\\program files (x86)\\mozilla firefox\\firefox.exe"); } }
i know pretty simple, can't still figure out. appreciated.
process p = runtime.getruntime().exec("\"c:\\program files (x86)\\mozilla firefox\\firefox.exe\"");
... or java 7 against windows ...
string[] command = new string[] { "c:" + file.separator + "program files (x86)" + file.separator + "mozilla firefox" + file.separator + "firefox.exe" }; process p = runtime.getruntime().exec(command);
Comments
Post a Comment