Solved

Detaching my java application from openoffice leaving it open

Posted on 2009-05-18
9
417 Views
Last Modified: 2013-11-13
Hello guys!

I'm facing the following problem: in my java application I need to open an openoffice calc spreadsheet, populate it with my data and then detach from OOo leaving the spreadsheet open on screen (this is mandatory, since the user expect to get an OOo calc open with certain data exported from my application, and then work with this data on calc).
I managed to get everything working (calc opens filled with data) but I don't understand how can I detach this calc window from my java app.

It seems that the communication bridge between java and OOo creates a new thread. When the user closes the java application, the JVM won't stop until all OOo instances are closed. I suspect that the java-OOo "bridge" live thread prevents the JVM to fully stop. Googling around the only way I found to detach is to stop OOo, but this is not what I want. OOo must stay open and fully detached from Java.

Any ideas? Thanks in advance.
0
Comment
Question by:uuderzo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24409717
>>It seems that the communication bridge between java and OOo creates a new thread

If your theory's correct, then try 'finding' that thread and interrupting it. Yes, that's an unfortunately low-level way of approaching it, but if the 'bridge' won't allow that via the api, then i can't think of another way
0
 

Author Comment

by:uuderzo
ID: 24409868
To give you more infos, my java app shouldn't close just after the export operation. The java app is a huge rich client J2EE application lauched via Java Web Start that usually keeps open all the day on user client machine (somethimes the application is closed and re-opened many times).

What I need is to communicate with OOo only for the time needed for the export operation, then detach. Both Java app and OOo keep open. My concern is because so many customers use it and I fear to receive many and many phone calls asking me why processes does not go down. I know that this is a difficult situation to obtain, since people probabily won't be aware of the existence of many unterminated JVMs... but usually users don't kill the OOo quickstart process (that keeps the bridge thread alive) and when you deal with such big apps every aspect can be a trouble.

I fear i'll not be able to find the right thread to stop. I must investigate further on this possibility.

Anyway, I'm looking for a UNO based solution (Universal Network Objects).
0
 

Author Comment

by:uuderzo
ID: 24410144
Tried to stop the tread. Nothing. Even System.exit(0) won't shut down the JVM.
This UNO bridge thread is really tough to know off.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 24410478
Have you thought about starting another JVM for the export?
0
 

Author Comment

by:uuderzo
ID: 24410547
I don't see the point in doing that. If the main or a secondary JVM doesn't shut down, the problem is the same for me.

Anyway, all my tests were performed on a simplified app lauched through a main method from the development environment. When I close the test frame, the dev environment shows me that the process is still on and closes only when I shutdown OOo.

Today I tried with the real application launched through JWS and it seems that the process goes down even if OOo is up. I don't know the reason of this different behavior, but this could lead to a non-problem. If the production environment works, I'm happy.

I'm still testing other cases, then bring back here for a conclusion.
0
 

Author Comment

by:uuderzo
ID: 24413232
Mmmmh... not so simple. Keeping the connection bridge opened after my export operation causes malfunctioning of other parts of the java application (developed by others) that deal with OOo in other way. Sounds like I must find a way to break the connection between java and OOo just after terminating my export.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 24413627
>>I don't see the point in doing that. If the main or a secondary JVM doesn't shut down, the problem is the same for me.

Well i was thinking at least you could close down the gui - but i take your point ;-)

afaicr there's a way of using TCP/IP to bridge is there not? That could obviate the coupling of processes
0
 

Author Comment

by:uuderzo
ID: 24419994
Your hint was really helpful.

Instead of working at XDesktop level I found a solution (http://www.oooforum.org/forum/viewtopic.phtml?t=35602) that works at XConnection level. That worked for me, other code now works still well also after my export operation.

Thank you for your support!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24420315
That's great :-)

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question