> > > passing a copy of that object is not what I want , I need to pass the
> > > exact object reference.
[quoted text clipped - 4 lines]
> each one of the two has main() function , do they run in different
> VMs?
Y
Philipp Leitner wrote:
>> > passing a copy of that object is not what I want , I need to pass the
>> > exact object reference.
[quoted text clipped - 4 lines]
>each one of the two has main() function , do they run in different
>VMs?
It depends on how they are launched. If boh are launched
from the command line, then yes. OTOH, if one is launched,
and it calls the main() of the other, they should both be
running in the same VM instance.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
micro - 20 Apr 2007 10:58 GMT
> Philipp Leitner wrote:
> >> > passing a copy of that object is not what I want , I need to pass the
[quoted text clipped - 10 lines]
> and it calls the main() of the other, they should both be
> running in the same VM instance.
actually one of them (lets call A)launch and in some point it calls
Runtime.exec() to make the other(lets call B) star
B needs a reference to an object that is initiated by A
Philipp Leitner - 20 Apr 2007 11:12 GMT
> actually one of them (lets call A)launch and in some point it calls
> Runtime.exec() to make the other(lets call B) star
> B needs a reference to an object that is initiated by A
Runtime.exec() starts a new subprocess. AFAIK this subprocess will run
in it's own VM, just as if you had launched it yourself from the
command line.
/philipp
Andrew Thompson - 20 Apr 2007 12:25 GMT
micro wrote:
>> actually one of them (lets call A)launch and in some point it calls
>> Runtime.exec() to make the other(lets call B) star
[quoted text clipped - 3 lines]
>in it's own VM, just as if you had launched it yourself from the
>command line.
If that is the case (don't know, and could not be bothered
checking) it might be better to get an instance of 'B' and
call the main(), as I alluded to earlier. In that case..
a) Both will be running in the same VM.
b) 'A' will have a reference to 'B', and can call the public methods.
(so B.setTheObjectOfInterest( theObject ) should work just fine.)

Signature
Andrew Thompson
http://www.athompson.info/andrew/
A. Bolmarcich - 21 Apr 2007 03:11 GMT
>> Philipp Leitner wrote:
>> >> > passing a copy of that object is not what I want , I need to pass the
[quoted text clipped - 14 lines]
> Runtime.exec() to make the other(lets call B) star
> B needs a reference to an object that is initiated by A
This may be a job for Java Remote Method Invocation. Please the
the tutorial at
http://java.sun.com/docs/books/tutorial/rmi/index.html
to determine if Java RMI supports what you what B to be able to
do with the object in the JVM running A.