Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

bug in "Runtime.getRuntime().exec()"

807606Jun 1 2007 — edited Jun 1 2007
the 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2007
Added on Jun 1 2007
34 comments
930 views