Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » preventing exit code window
preventing exit code window [message #478948] Fri, 07 August 2009 15:38 Go to next message
Jörg Kiegeland is currently offline Jörg KiegelandFriend
Messages: 32
Registered: July 2009
Member
If my rcp application executes System.exit(1), then the typical window
with the message "JVM terminated. Exit code=1 ..[startup parameters]"
appears. How can I prevent this window from being displayed?

As you may ask now why I use exit codes: another program starts the rcp
application and evaluates the exit code after the rcp is closed by the
user. This other program allows communication only by exit codes. The
exit code returned by the RCP depends on what the user did.
Re: preventing exit code window [message #480688 is a reply to message #478948] Tue, 18 August 2009 08:42 Go to previous messageGo to next message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 117
Registered: July 2009
Location: Seoul
Senior Member

If your application based on workbench, There is no way to override
return code in general approach.

But, System.exit() is much worse idea. It can cause a lot of data loss.

So, I suggest alternative way:

IWorkbench bench = PlatformUI.getWorkbench();

Method closeMethod =
bench.getClass().getDeclaredMethod("close", int.class, boolean.class);
closeMethod.setAccessible(true);

closeMethod.invoke(bench, YOUR_RETURN_CODE, true);




Jörg Kiegeland wrote:
> If my rcp application executes System.exit(1), then the typical window
> with the message "JVM terminated. Exit code=1 ..[startup parameters]"
> appears. How can I prevent this window from being displayed?
>
> As you may ask now why I use exit codes: another program starts the rcp
> application and evaluates the exit code after the rcp is closed by the
> user. This other program allows communication only by exit codes. The
> exit code returned by the RCP depends on what the user did.
Re: preventing exit code window [message #500716 is a reply to message #480688] Fri, 27 November 2009 16:36 Go to previous message
Dawid Kostrzycki is currently offline Dawid KostrzyckiFriend
Messages: 5
Registered: July 2009
Junior Member
Hi,

is it possible to suppress this popup window being displayed if my
command line RCP application is NOT based on workbench ?

best regards
Dawid

Am Tue, 18 Aug 2009 17:42:23 +0900 schrieb Jiyul:

> If your application based on workbench, There is no way to override
> return code in general approach.
>
> But, System.exit() is much worse idea. It can cause a lot of data loss.
>
> So, I suggest alternative way:
>
> IWorkbench bench = PlatformUI.getWorkbench();
>
> Method closeMethod =
> bench.getClass().getDeclaredMethod("close", int.class, boolean.class);
> closeMethod.setAccessible(true);
>
> closeMethod.invoke(bench, YOUR_RETURN_CODE, true);
>
>
>
>
> Jörg Kiegeland wrote:
>> If my rcp application executes System.exit(1), then the typical window
>> with the message "JVM terminated. Exit code=1 ..[startup parameters]"
>> appears. How can I prevent this window from being displayed?
>>
>> As you may ask now why I use exit codes: another program starts the rcp
>> application and evaluates the exit code after the rcp is closed by the
>> user. This other program allows communication only by exit codes. The
>> exit code returned by the RCP depends on what the user did.
Previous Topic:64-bit Eclipse RCP development environment on 64-bit Windows 7
Next Topic:Suppressing preference contributions
Goto Forum:
  


Current Time: Tue Mar 19 07:10:34 GMT 2024

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

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

Back to the top