Error While Running Windows Command Line Instruction
I am running the following code to open a file using the default application in Windows:
The problem is:
String s1 = jfilechooser.getSelectedFile().getPath();
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("cmd /c start "+s1);
if the file/directory name contains a space, it does not give the full name at the command line, even though it works PERFECTLY for files/folders whose names do not contain spaces.
if i select "Hello.txt", it works fine.
but if i select "Bye Dude.txt", Windows gives me an error saying:
"Bye" could not be found.
What should i do to solve this? PLEASE HELP!!!