• Post Reply Bookmark Topic Watch Topic
  • New Topic

waitFor() does not wait for LibreOffice calc.  RSS feed

 
Javier Corral
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to call LibreOffice calc from Java and wait until the Calc finish, I mean, when the user saves the spreadsheet and closes the program.
The problem is that waitFor() continues and doesn't wait.
This is the code:




I realized that, when LibreOffice is in memory to run faster, then waitFor does not work. But if LibreOffice is run directly then waitFor work.

I appreciate any help in advance.

Javiercl.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javier Corral wrote:
I realized that, when LibreOffice is in memory to run faster, then waitFor does not work. But if LibreOffice is run directly then waitFor work.


The waitFor() method does wait until the process exits. I don't know what you mean about it being "in memory to run faster", but if that means that the LibreOffice command kicks off a background job and then exits, then what you're seeing is totally expected--the LibreOffice command has completed, even if not all of the work it's initiating is done.
 
Javier Corral
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

I think that after starting LibreOffice, this gives control to a background process and then LibreOffice finishes immediately. I have asked a question to LibreOffice forum. If they give me some answer I'll put it here.

Regards.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!