Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » IShellService cannot open file
IShellService cannot open file [message #1281092] Mon, 31 March 2014 10:48 Go to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 310
Registered: August 2011
Senior Member
Hi,

I generate docx documents and save them on disk. Then if I want to open that document from within my application with IShellService.shellOpen I get a window message "Can't find file 'path\filename.docx'".

I can open this file directly from windows explorer by a double click. I can open other .docx files. The path is correct. It is the same after closing and reopening my application, so nothing is kept in memory (even after restarting the computer.)

So what goes wrong with opening this file with IShellService.shellOpen ?

Regards Bertin
Re: IShellService cannot open file [message #1281119 is a reply to message #1281092] Mon, 31 March 2014 11:39 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 817
Registered: October 2011
Senior Member
Are you really sure the file is where you think it is (Can Windows "Program Files" sandboxing mechanism be involved ?).

Have you tried with an other file path?
Is there any log/console output?
Re: IShellService cannot open file [message #1281167 is a reply to message #1281092] Mon, 31 March 2014 13:07 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 310
Registered: August 2011
Senior Member
Hi, it works if I replace

 File outFile = new File(outFilePath);
 wordprocessingMLPackage.save(outFile);
 SERVICES.getService(IShellService.class).shellOpen(outFilePath);


by

 File outFile = new File(outFilePath);
 wordprocessingMLPackage.save(outFile);
 if (java.awt.Desktop.isDesktopSupported()) {
    java.awt.Desktop.getDesktop().open(new File(outFilePath));
 }


Tested a lot and the only thing I can find now is that IShellService.shellOpen gives a message on genereated files. No log/console output.
icon7.gif  Re: IShellService cannot open file [message #1283759 is a reply to message #1281092] Thu, 03 April 2014 19:58 Go to previous message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 310
Registered: August 2011
Senior Member
Solved.

In some generated file names there were two spaces after each other e.g. 'My new file.docx' This was hardly visible on the screen. This file could not be opened with IShellService.shellOpen but it could be opened with java.awt.Desktop.getDesktop().open.

After replacing the double space with a single one (at generation time) it works again.

Regards Bertin

PS normally there is no problem when opening a filename with two spaces in it, but it seems there is when it is generated by docx4j, did not investigate that any further.

Previous Topic:Different Cell types in the same column
Next Topic:Checking field validity
Goto Forum:
  


Current Time: Fri Dec 19 21:55:50 GMT 2014

Powered by FUDForum. Page generated in 0.09999 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software