OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to exit a java UNO program

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
wanjiankz
General User
General User


Joined: 13 Apr 2005
Posts: 5

PostPosted: Thu Apr 28, 2005 3:29 am    Post subject: How to exit a java UNO program Reply with quote

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
Code:
System.exit(0);
, the program won't exit, the MessageDispatcher thread is always in the system, so how can I exit the java program without
Code:
System.exit(0);
?

Anyone knows, pls tell me, thx.
Back to top
View user's profile Send private message
mnasato
Power User
Power User


Joined: 26 Apr 2005
Posts: 54
Location: London, U.K.

PostPosted: Thu Apr 28, 2005 6:07 am    Post subject: Re: How to exit a java UNO program Reply with quote

Care to post the relevant portions of your code?
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Thu Apr 28, 2005 8:10 am    Post subject: Reply with quote

I think there are part of your code which are threads, even if you don't program them explicitely. I think it's probably the case which the dispatcher but it may be check.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
wanjiankz
General User
General User


Joined: 13 Apr 2005
Posts: 5

PostPosted: Thu Apr 28, 2005 7:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Thu Apr 28, 2005 10:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
malco_man
General User
General User


Joined: 25 Apr 2005
Posts: 6

PostPosted: Thu Apr 28, 2005 11:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
mnasato
Power User
Power User


Joined: 26 Apr 2005
Posts: 54
Location: London, U.K.

PostPosted: Fri Apr 29, 2005 5:40 am    Post subject: Reply with quote

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
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Fri Apr 29, 2005 11:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group