java.io.IOException when using Desktop.getDesktop().open
795658Dec 14 2008 — edited Dec 14 2008Hi Guys,
I am trying to open a file using Desktop.getDesktop().open() and get this exception:
2008-12-09 09:36:16,537 [SwingWorker-pool-1-thread-68] ERROR
(PDFExporter.java:121) - Could not generate report
java.io.IOException: Failed to open
file:/C:/Documents%20and%20Settings/labuser/Desktop/myfile.pdf. Error
message: The parameter is incorrect.
at sun.awt.windows.WDesktopPeer.ShellExecute(Unknown Source)
at sun.awt.windows.WDesktopPeer.open(Unknown Source)
at java.awt.Desktop.open(Unknown Source)
at
com.nolio.platform.shared.app.view.reports.export.PDFExporter.export(PDFExporter.java:116)
at
com.nolio.platform.shared.app.view.reports.ReportView$2$1.doInBackground(ReportView.java:95)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I think that the problem is related to the encoding '%20'. when I use file.getPath() (or file.getAbsolutePath() ) I get a clear path (without encoding- just normal spaces).
Can you tell why the %20 is added? how can I remove it (or have the system use it).
Thanks,
Uri