Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception while opening a Remote file.  RSS feed

 
Pratik Goswami
Ranch Hand
Posts: 136
Android Chrome Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends.
In a GUI application i am opening file in its default application launcher (e.g. Microsoft office for word document, Notepad for txt document etc..). This functionality works fine with Local folders' files. But when i try to open a shared folder(remote folder) file it gives me exception.
When i execute code space is automatically omitted by %20 and exception is raised. I have full rights on this remote folder. I can copy and paste files using file I/O. That is running perfectly.
java.io.IOException: Failed to open file:////java004/Demo%20Output/AppendFolder.doc. Error message: The system cannot find the path specified.

Remote file's path is like this - "//java004/Demo Output/AppendFolder.doc"

Code is here


Any help would be appreciated.

Thanks in advance
Pratik.
 
Pratik Goswami
Ranch Hand
Posts: 136
Android Chrome Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
This problem is actually a bug that is reported on Sun Java. Here is the link - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6780505. Then I have tried another method from Runtime class.
Code
This is working fine for shared files.
Ahha, there is still a problem, if there are two shared folder named demo and demo output and if you want to open a file that is stored in demo output folder, the system will open demo folder instead of opening demo output folder's file. Strange!!!

Waiting for comments and suggestions.

Thanks.
Pratik Goswami.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!