Article View: borland.public.jbuilder.java.language
Article #8639Re: Calling applis from an appli
From: icsd.jt
Date: Mon, 05 Mar 2001 07:12
Date: Mon, 05 Mar 2001 07:12
230 lines
10933 bytes
10933 bytes
C'est un message de format MIME en plusieurs parties.
------=_NextPart_000_0095_01C0A54C.03A0C7E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I think I have understand your explanations and
I highly thank you. There remains to me a question:
To test I put 2 applications in the same directory
(the two run each alone correctly):
1-application (Zones) with main()=20
simple management of a table with jdbtable
2-the appealing menu (Mmenu) only with a button
void jButton1_actionPerformed(ActionEvent e) {
// call main() Zones=20
}
Can you me specify how to call Zones in Mmenu.
I have try
Zones.CadZ(); // CadZ is the main method of the appli Zones
Zones.main() .....
but F9 say always to me
variable Zones is unknow in class Mmenu=20
(with or without import Zones; )
however I see in the structur panel the packet Zones
and the helps of JB4 EDI proposes well to me Zones.Cadz
The two applications have different package name : it's important ?=20
In advance large thank.
Regards, Jacques
"John McGrath [TeamB]" <ng-b@JPMcGrath.net> a =E9crit dans le message =
news: MPG.150b85684df4a28498a003@forums.borland.com...
> On Sat, 3 Mar 2001 16:30:25 +0100, icsd.jt@wanadoo.fr wrote:
>=20
> > I want just grouping this applications in one alone or make
> > an super main menu for reduce the chargement time.
> > It ' s possible ? and how .
>=20
> Sure, that is possible, and it sounds like it would be an ideal way to =
> run those "applications". When you run them all in a single virtual=20
> machine, they will start faster and consume a lot less resources.
>=20
> I am assuming that you have control of the source of the applications. =
=20
> If so, then you will probably just have to make a few simple changes =
to=20
> the structure of the applications to make them co-exist in the same VM =
> with other code. It is even possible that the applications are =
already=20
> well behaved, and no changes will be needed.
>=20
> The area that is most likely to be an issue is how the applications=20
> shut themselves down. If one of the applications calls System.exit(), =
> it will shut down the virtual machine, so your menu and any other=20
> running applications will terminate as well.
>=20
> Exactly how to deal with this will depend on the structure of your=20
> applications. Assuming that they are typical Java GUI programs, they=20
> have a main() method that instantiates a single frame and shows it. =
In=20
> that case, you can just have your menu instantiate and show the frame=20
> when the user runs the application from the menu.
>=20
> The best way to deal with the exit() issue is to have the exit =
function=20
> for the application just dispose the frame. Then from the main()=20
> method, add a WindowListener to the frame that detects the =
windowClosed=20
> event (not windowClosing), and does an exit when that occurs.
>=20
> Other areas to watch out for is how static variables are initialized=20
> and handled. If an application assumes that it will be the only user=20
> of such variables, it may find that it is wrong.
>=20
> Another concern is the reentrancy of the applications. When run from=20
> the main() method, they are always run once and then the VM is shut=20
> down after one execution. But with this model, it will be possible to =
> run the application multiple times. So keep an eye out for code that=20
> makes such assumptions.
>=20
> If you do this right, the applications should be able to run from the=20
> command line or from your menu without any noticeable difference in=20
> their behavior. =20
>=20
> Good luck, and left us know how it works out for you.
>=20
> --=20
> Regards,
>=20
> John McGrath [TeamB]
>=20
> ---------------------------------------------------
> Before sending me e-mail, please read:
> http://www.JPMcGrath.net/newsgroups/e-mail.html
------=_NextPart_000_0095_01C0A54C.03A0C7E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I think I have understand your =
explanations=20
and<BR>I highly thank you. There remains to me a question:<BR>To =
test I=20
put 2 applications in the same directory<BR> (the two run =
each alone=20
correctly):<BR>1-application (Zones) with main() <BR> simple =
management of=20
a table with jdbtable<BR>2-the appealing menu (Mmenu) only with a=20
button<BR> void jButton1_actionPerformed(ActionEvent e)=20
{<BR> // call main() Zones <BR> }<BR>Can you me =
specify=20
how to call Zones in Mmenu.<BR>I have try<BR> Zones.CadZ(); =
// CadZ=20
is the main method of the appli Zones<BR> Zones.main() =
.....<BR> but=20
F9 say always to me<BR> variable Zones is unknow =
in=20
class Mmenu <BR> (with or=20
without import Zones; )<BR> however I see in the =
structur panel=20
the packet Zones<BR> and the helps of JB4 EDI proposes well to me=20
Zones.Cadz</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The two applications have different =
package name=20
: it's important ?</FONT><FONT face=3DArial =
size=3D2> <BR>In advance=20
large thank.<BR>Regards, Jacques<BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2>"John McGrath [TeamB]" <</FONT><A=20
href=3D"mailto:ng-b@JPMcGrath.net"><FONT face=3DArial=20
size=3D2>ng-b@JPMcGrath.net</FONT></A><FONT face=3DArial size=3D2>> a =
=E9crit dans le=20
message news: </FONT><A=20
href=3D"mailto:MPG.150b85684df4a28498a003@forums.borland.com"><FONT =
face=3DArial=20
size=3D2>MPG.150b85684df4a28498a003@forums.borland.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> On Sat, 3 Mar =
2001 16:30:25=20
+0100, </FONT><A href=3D"mailto:icsd.jt@wanadoo.fr"><FONT face=3DArial=20
size=3D2>icsd.jt@wanadoo.fr</FONT></A><FONT face=3DArial size=3D2> =
wrote:<BR>>=20
<BR>> > I want just grouping this applications in one alone or=20
make<BR>> > an super main menu for reduce the chargement =
time.<BR>>=20
> It ' s possible ? and how .<BR>> <BR>> Sure, that is =
possible, and it=20
sounds like it would be an ideal way to <BR>> run those =
"applications". =20
When you run them all in a single virtual <BR>> machine, they will =
start=20
faster and consume a lot less resources.<BR>> <BR>> I am assuming =
that you=20
have control of the source of the applications. <BR>> If so, =
then you=20
will probably just have to make a few simple changes to <BR>> the =
structure=20
of the applications to make them co-exist in the same VM <BR>> with =
other=20
code. It is even possible that the applications are already =
<BR>> well=20
behaved, and no changes will be needed.<BR>> <BR>> The area that =
is most=20
likely to be an issue is how the applications <BR>> shut themselves=20
down. If one of the applications calls System.exit(), <BR>> it =
will=20
shut down the virtual machine, so your menu and any other <BR>> =
running=20
applications will terminate as well.<BR>> <BR>> Exactly how to =
deal with=20
this will depend on the structure of your <BR>> applications. =
Assuming=20
that they are typical Java GUI programs, they <BR>> have a main() =
method that=20
instantiates a single frame and shows it. In <BR>> that case, =
you can=20
just have your menu instantiate and show the frame <BR>> when the =
user runs=20
the application from the menu.<BR>> <BR>> The best way to deal =
with the=20
exit() issue is to have the exit function <BR>> for the application =
just=20
dispose the frame. Then from the main() <BR>> method, add a=20
WindowListener to the frame that detects the windowClosed <BR>> event =
(not=20
windowClosing), and does an exit when that occurs.<BR>> <BR>> =
Other areas=20
to watch out for is how static variables are initialized <BR>> and=20
handled. If an application assumes that it will be the only user =
<BR>>=20
of such variables, it may find that it is wrong.<BR>> <BR>> =
Another=20
concern is the reentrancy of the applications. When run from =
<BR>> the=20
main() method, they are always run once and then the VM is shut <BR>> =
down=20
after one execution. But with this model, it will be possible to =
<BR>>=20
run the application multiple times. So keep an eye out for code =
that=20
<BR>> makes such assumptions.<BR>> <BR>> If you do this right, =
the=20
applications should be able to run from the <BR>> command line or =
from your=20
menu without any noticeable difference in <BR>> their behavior. =
<BR>> <BR>> Good luck, and left us know how it works out for =
you.<BR>>=20
<BR>> -- <BR>> Regards,<BR>> <BR>> John McGrath =
[TeamB]<BR>>=20
<BR>> ---------------------------------------------------<BR>> =
Before=20
sending me e-mail, please read:<BR>> </FONT><A=20
href=3D"http://www.JPMcGrath.net/newsgroups/e-mail.html"><FONT =
face=3DArial=20
size=3D2>http://www.JPMcGrath.net/newsgroups/e-mail.html</FONT></A></BODY=
></HTML>
------=_NextPart_000_0095_01C0A54C.03A0C7E0--
Technical Details
Message-ID:
<3aa33b30_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!news.stealth.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!193.252.62.85References:
<3aa0a077_1@dnews> <MPG.150a9aa7fc92fce5989ffc@forums.borland.com> <3aa10cea$1_2@dnews> <MPG.150b85684df4a28498a003@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,ec6af10449d9afc3 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-04 23:16:12 PST Reply-To: <icsd.jt@wanadoo.fr> From: <icsd.jt@wanadoo.fr> Newsgroups: borland.public.jbuilder.java.language References: <3aa0a077_1@dnews> <MPG.150a9aa7fc92fce5989ffc@forums.borland.com> <3aa10cea$1_2@dnews> <MPG.150b85684df4a28498a003@forums.borland.com> Subject: Re: Calling applis from an appli Date: Mon, 5 Mar 2001 08:12:26 +0100 Lines: 232 Organization: ICSD - JaC MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0095_01C0A54C.03A0C7E0" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 193.252.62.85 Message-ID: <3aa33b30_1@dnews> X-Trace: 4 Mar 2001 23:07:28 -0800, 193.252.62.85 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!news.stealth.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!dnews!193.252.62.85