tips:java:launchappwithspace
Launching an Application with a Space in its Name
Using Runtime.getRuntime().exec() to launch an application is pretty straight forward, except when you're trying to start an application whose name contains one or more spaces.
Under Windows, you need to quote the application name:
Runtime.getRuntime().exec("\"My Appliaction.exe\"");
or use a String array:
Runtime.getRuntime().exec(new String[]{"My Application.exe"});
Under Mac OS X, you need to call open:
Runtime.getRuntime().exec(new String[]{"open", "My Application.app"});
Under Linux, you must use a String array:
Runtime.getRuntime().exec(new String[]{"My Application"});
tips/java/launchappwithspace.txt · Last modified: 2009/06/08 12:03 by erik