Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » launching another Java app from within an RCP app
launching another Java app from within an RCP app [message #449769] Thu, 18 May 2006 23:00 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:Dynamic language support
Next Topic:Progress Groups
Goto Forum:
  


Current Time: Thu Apr 25 08:59:27 GMT 2024

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

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

Back to the top