| View previous topic :: View next topic |
| Author |
Message |
wanjiankz General User

Joined: 13 Apr 2005 Posts: 5
|
Posted: Thu Apr 28, 2005 3:29 am Post subject: How to exit a java UNO program |
|
|
When I use java UNO to do some operations of OOo documents, such as open a new writer, and fill some text to it, then the java program should exit normally, but I found if I don't use the , the program won't exit, the MessageDispatcher thread is always in the system, so how can I exit the java program without ?
Anyone knows, pls tell me, thx. |
|
| Back to top |
|
 |
mnasato Power User

Joined: 26 Apr 2005 Posts: 54 Location: London, U.K.
|
Posted: Thu Apr 28, 2005 6:07 am Post subject: Re: How to exit a java UNO program |
|
|
| Care to post the relevant portions of your code? |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
wanjiankz General User

Joined: 13 Apr 2005 Posts: 5
|
Posted: Thu Apr 28, 2005 7:04 pm Post subject: |
|
|
I have see all the OOO Text code examples which in the OpenOffice.org1.1_SDK, it's path is OpenOffice.org1.1_SDK\examples\java\Text.
I found a interesting problem, every code have System.exit(0); in the Main function,
if remove the System.exit(0); every code will not exit normally!
So my question is how to exit without writing System.exit(0); in my code.
Thx again. |
|
| Back to top |
|
 |
hol.sten Super User


Joined: 14 Nov 2004 Posts: 3533 Location: Hamburg, Germany
|
Posted: Thu Apr 28, 2005 10:19 pm Post subject: |
|
|
| wanjiankz wrote: | I found a interesting problem, every code have System.exit(0); in the Main function,
if remove the System.exit(0); every code will not exit normally! |
That's even the same with my batch test application. Please explain, why you want to live without it. I had never a problem with that statement.
With kind regards
hol.sten |
|
| Back to top |
|
 |
malco_man General User


Joined: 25 Apr 2005 Posts: 6
|
Posted: Thu Apr 28, 2005 11:19 pm Post subject: |
|
|
You said ==> why you want to live without it. I had never a problem with that statement.
I 'm using a no java application, but it can call methods java. But you could say "call the method exit of System", but if I do this the application crash showing me an error 'Server Connection lose'.
So I need to know how terminate without call exit (Though it is a simple example, purely java).
Thanks.
Good luck wanjiankz. |
|
| Back to top |
|
 |
mnasato Power User

Joined: 26 Apr 2005 Posts: 54 Location: London, U.K.
|
Posted: Fri Apr 29, 2005 5:40 am Post subject: |
|
|
| hol.sten wrote: | | wanjiankz wrote: | I found a interesting problem, every code have System.exit(0); in the Main function,
if remove the System.exit(0); every code will not exit normally! |
That's even the same with my batch test application. Please explain, why you want to live without it. I had never a problem with that statement. |
Well suppose you have a servlet running inside say Tomcat... calling System.exit() will shut down the whole Tomcat server!
I seem to remember that the examples use a simple but limited approach. I used a more advanced one (using XBridgeFactory) in my open source project JooConverter so that a UnoConnection can be explicitly close()d. Source available at
http://sourceforge.net/projects/joott/
Cheers
Mirko |
|
| Back to top |
|
 |
hol.sten Super User


Joined: 14 Nov 2004 Posts: 3533 Location: Hamburg, Germany
|
Posted: Fri Apr 29, 2005 11:59 am Post subject: |
|
|
| mnasato wrote: | | Well suppose you have a servlet running inside say Tomcat... calling System.exit() will shut down the whole Tomcat server! |
I've heard that it is not clever to use System.exit(0) inside a servlet. But even without using System.exit(0) in our web application, Tomcat and OpenOffice.org terminates themself when I shutdown Tomcat.
With kind regards
hol.sten |
|
| Back to top |
|
 |
|