Skip to Main Content

problem in executing jar when the folder name has empty space

843810Jul 15 2010 — edited Jul 15 2010
Hi,
I need to run my java swing application on double clicking the jar file. It works fine when the file path has no empty spaces in the folder name. It doesnt open when the folder name has spaces in between them. Can anyone let me know how to resolve it.
String workingDir = new File("SwingApplication").getAbsolutePath(); 
String cmd = "java -jar " ++workingDir ++"/SwingApplication.jar"; 
Runtime.getRuntime().exec(cmd);
This works fine when the SwingApplication.jar is inside for eg: c://{color:#ff0000}RunApplication{color}/SwingApplication.jar
but the application doesnt open if the file path is c://{color:#0000ff}Run Application{color}/SwingApplication.jar
Comments
Post Details
Added on Jul 15 2010
7 comments
1,207 views