Launch a new java app from a java program

?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Roedy said:
If it is written in Java it must have a main method. Other wise how
would you start it?

App means (no guarantee of interface) and (a static main method)

:)

Arne
 
A

Andrew Thompson

Christian said:
but without exec the program will run in the same jvm...

Of course.
...may be sharing
the same singletons..

It is not suitable for all situations, and he OP has since(?)
clarified that this task needs to be done in a separate JVM.

And to the OP - do you now see the advantage of actually
*describing* the problem domain, rather than simply give a
vague description and 'what you want to do'?
 
P

Patricia Shanahan

Andrew said:
Of course.


It is not suitable for all situations, and he OP has since(?)
clarified that this task needs to be done in a separate JVM.

And to the OP - do you now see the advantage of actually
*describing* the problem domain, rather than simply give a
vague description and 'what you want to do'?

However, even with the initial description my assumption would be exec.
I don't think the main call technique should ever be used to "launch
another java app".

It is only really a good technique for running a main class that is
logically part of the calling application, so closely coordinated with
it that the caller and callee should run as one application, using a
single environment, class loader, heap, etc.

Patricia
 
R

Roedy Green

App means (no guarantee of interface) and (a static main method)

Application implies you can start it from the command line. That
implies a main method.

Otherwise you would call it as class or a library.
 
Y

Yao Qi

Andrew Thompson said:
Christian wrote:
It is not suitable for all situations, and he OP has since(?)
clarified that this task needs to be done in a separate JVM.

And to the OP - do you now see the advantage of actually
*describing* the problem domain, rather than simply give a
vague description and 'what you want to do'?

Is OP me here? I think I described my question clearly. Here is what I
posted here in this thread,

"I want to write a java program A to launch another java app B. I hope I
could configure the argument of VM to launch java app B, just like what
Eclipse JDT does.(Eclipse is a java program, and it could launch other
java apps.) I do not want to create a new thread for java app B. I
prefer to run java app B on another process separately."

Is the description vague? If there is something confusing, point it
out. I would like to improve my English skills. :)

Best Regards
 
A

Andrew Thompson

Yao said:
Is OP me here?

Yes. OP stands for the 'Original Poster' - the person
that started the thread.
...I think I described my question clearly. Here is what I
posted here in this thread,

"I want to write a java program A to launch another java app B. I hope I
could configure the argument of VM to launch java app B, just like what
Eclipse JDT does.(Eclipse is a java program, and it could launch other
java apps.) I do not want to create a new thread for java app B. I
prefer to run java app B on another process separately."

Is the description vague?
No.

...If there is something confusing, point it
out. I would like to improve my English skills. :)

Your english skills are fine. Apparently a lot better than
mine on the day I misread the question and made that
remark, ..or it's been a long thread and I missed some
details, or..(insert other pathetic excuses here) ;-)

One thing I did notice in my browsings of this thread and
*links*, is that ProcessBuilder seems to be the preferred
way to go about getting a Process, rather than calling
exec().

Has that been explicitly mentioned/discussed?

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200707/1
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Roedy said:
Application implies you can start it from the command line. That
implies a main method.

True.

But it does definitely not imply an interface with a non
static method which your solution required.

Arne
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Roedy said:
Yes, the Class.forName approach requires the you to implement some
common interface in your dynamic classes.

No it does not.

You can use reflection instead.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top