Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » preventing exit code window
preventing exit code window [message #478948] Fri, 07 August 2009 11:38 Go to next message
Eclipse UserFriend
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 04:42 Go to previous messageGo to next message
Eclipse UserFriend
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 11:36 Go to previous message
Eclipse UserFriend
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: Sat Jul 05 04:26:34 EDT 2025

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

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

Back to the top