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!

How to handle spaces in using path to the file

807589Nov 24 2008 — edited Nov 24 2008
Hi Friends,

I am getting error "file not found" if I give path of the file that contains spaces in it. (eg. C:\Users\Sample Project\file.txt)
If I give path that doesn't contain spaces (eg. C:\Users\Sample\file.txt) then it works fine without any error.

Basically I am invoking one command at runtime (using "exec") in my java program that excepts path of the file as one parameter.
I can't remove space by manipulating path - othewise that path will be different.

How can I solve this issue?
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2008
Added on Nov 24 2008
4 comments
419 views