• Post Reply Bookmark Topic Watch Topic
  • New Topic

Desktop.open(), trouble decoding URI  RSS feed

 
Bill Clar
Ranch Hand
Posts: 163
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I'm trying to launch a MS Word document on a Windows 7 desktop.



I get this error: java.io.IOException: Failed to open file:/C:/Program%20Files%20(x86)/JudicialViewer/./temp/2014GA000939_Seq_15.doc. Error message: The system cannot find the file specified.

I googled and came across this thread at StackOverflow. I implemented the accepted answer as seen above. Still nothing.

This code works fine on Windows XP. I only have this problem on Windows 7.

I'm using Java 7 on both desktops (XP & Windows 7).
 
Bill Clar
Ranch Hand
Posts: 163
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the full path name works:



Not sure why, but it works on Windows 7. No %20 codes in the fileURI string.
 
Paul Clapham
Sheriff
Posts: 22827
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's all the file-to-URI-to-file for? Why not just this:


 
Bill Clar
Ranch Hand
Posts: 163
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was my original approach. It didn't work. Apparently on Windows 7, the relative path name was encoded to use %20 for spaces which resulted in C:/Program%20Files%20(x86)/JudicialViewer/./temp/2014GA000939_Seq_15.doc.

So, I either needed to replace "%20" with spaces or build the absolute file name. I tried the latter and it worked.




 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!