launching another Java app from within an RCP app [message #449769] |
Thu, 18 May 2006 23:00 |
Eclipse User |
|
|
|
Originally posted by: subscriber.pikesoft.com
I have a requirement to launch a second Java app from within my RCP app.
I've tried two sort of standard ways of doing this and neither is
satisfactory:
* If I call the second applications main() method and then the user closes
that application it crashes the RCP app, too (presumably since they run in
the same process)
* If I use Runtime.getRuntime().exec(java blahBlahBlah) I lose the ability
to close the second application programmatically from within the RCP app,
which is a requirement.
What I'd like is to do what the JDT does where you can both launch and exit
an application from RCP, but I don't want to include the JDT as a plugin and
have all the launch configuration stuff contributed to my RCP app. I've
been rooting around in the Eclipse source code for a while but haven't been
able to figure out how this is accomplished. Can anyone offer a suggestion
or point me in the right direction?
TIA!
--
David Beers
Pikesoft Mobile Computing
www.pikesoft.com
|
|
|
Re: launching another Java app from within an RCP app [message #449778 is a reply to message #449769] |
Fri, 19 May 2006 05:30 |
Eclipse User |
|
|
|
Originally posted by: Stephen.Egan.csiro.au
I would suggest copy & pasting all the code from the secondary =
application's main() methof into a method in your RCP app and call that =
=
instead, or better again to put that code in a method of your secondary =
=
app that both its main() method and your RCP app can call. You'll also =
=
need to make sure that any window listeners in the secondary app aren't =
=
calling System.exit() on window close. I'd be surprised if that isn't t=
he =
case, and is probably the cause of the RCP crash you've been experiencin=
g =
in scenario 1.
Hope that's of some help,
Stephen
On Fri, 19 May 2006 09:00:39 +1000, David Beers <subscriber@pikesoft.com=
> =
wrote:
> I have a requirement to launch a second Java app from within my RCP ap=
p.
> I've tried two sort of standard ways of doing this and neither is
> satisfactory:
>
> * If I call the second applications main() method and then the user =
> closes
> that application it crashes the RCP app, too (presumably since they ru=
n =
> in
> the same process)
>
> * If I use Runtime.getRuntime().exec(java blahBlahBlah) I lose the =
> ability
> to close the second application programmatically from within the RCP a=
pp,
> which is a requirement.
>
> What I'd like is to do what the JDT does where you can both launch and=
=
> exit
> an application from RCP, but I don't want to include the JDT as a plug=
in =
> and
> have all the launch configuration stuff contributed to my RCP app. I'=
ve
> been rooting around in the Eclipse source code for a while but haven't=
=
> been
> able to figure out how this is accomplished. Can anyone offer a =
> suggestion
> or point me in the right direction?
>
> TIA!
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
Re: launching another Java app from within an RCP app [message #449787 is a reply to message #449769] |
Fri, 19 May 2006 12:34 |
|
David Beers wrote:
> I have a requirement to launch a second Java app from within my RCP app.
> I've tried two sort of standard ways of doing this and neither is
> satisfactory:
>
> * If I call the second applications main() method and then the user closes
> that application it crashes the RCP app, too (presumably since they run in
> the same process)
>
> * If I use Runtime.getRuntime().exec(java blahBlahBlah) I lose the ability
> to close the second application programmatically from within the RCP app,
> which is a requirement.
>
> What I'd like is to do what the JDT does where you can both launch and exit
> an application from RCP, but I don't want to include the JDT as a plugin and
> have all the launch configuration stuff contributed to my RCP app. I've
> been rooting around in the Eclipse source code for a while but haven't been
> able to figure out how this is accomplished. Can anyone offer a suggestion
> or point me in the right direction?
>
> TIA!
>
Actually, at least one way that JDT launches java is to use
Runtime#exec() and then kill the Process like this (from RuntimeProcess
in org.eclipse.debug.core):
Process process = getSystemProcess();
if (process != null) {
process.destroy();
}
I've also followed up to JDT, which controls the launch configurations.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Powered by
FUDForum. Page generated in 0.02770 seconds