bug in "Runtime.getRuntime().exec()"
807606Jun 1 2007 — edited Jun 1 2007the command:
Runtime.getRuntime().exec("ln -s /home/Vvn/temp/a.txt /home/Vvn/temp/a\\ slnk.txt");
is never executed.
I figured out the problem. Java is not able to handle spaces in the filenames.
Simply using:
Runtime.getRuntime().exec("ln -s /home/Vvn/temp/a.txt /home/Vvn/temp/a\ slnk.txt");
will complain of a compilation error saying it as "illegal escape character. Hence i am forced to use "a\\ slnk.txt". but this should not be a problem because actually the string will be without the escape character when it is executed.
Can anyone let me know if you succeed in linking files having spaces in their filenames.
As a matter of fact ,if you can execute any other command (like "rm a\ slnk.txt" etc...) having spaces in the filenames. Please let me know.
Thank you. -Vvn