Runtime.exec classpth

P

puzzlecracker

if I want to run a java application from the same java application:
meaning parent process spawns a child process, but passes different
parameters (to avoid infinite spawning); does the child inherits
parent's classpath and other configurations
or do I need to pass the classpath along?

If I am using linux env. and exported the classpath, will it be used.

Basically, I want the application to run on win32 (eclipse) and Linux.

Also, child process does a lot of printing, should create another
thread to monitor and read its output or what?

what is the general pattern for this kind of a thing.

Suggestions and examples will be appreciated.

Thanks

ps.I was trying to do something with listerner but cannot get printing
to work.....
 
R

Rhino

puzzlecracker said:
if I want to run a java application from the same java application:
meaning parent process spawns a child process, but passes different
parameters (to avoid infinite spawning); does the child inherits
parent's classpath and other configurations
or do I need to pass the classpath along?

If I am using linux env. and exported the classpath, will it be used.

Basically, I want the application to run on win32 (eclipse) and Linux.

Also, child process does a lot of printing, should create another
thread to monitor and read its output or what?

what is the general pattern for this kind of a thing.

Suggestions and examples will be appreciated.

Thanks

ps.I was trying to do something with listerner but cannot get printing
to work.....
I found this article -
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html - very
helpful when I was getting started with runtime.exec(). You need to be a
little patient - the author takes some time to build up to the best approach
for using runtime.exec() - but I think you will do fine if you stick with
him to the end.

Rhino
 
R

Ranganath Kini

Why do u wanna chain multiple processes when ure trying to invoke 1
Java app thru another Java app?

Cant u create a new instance of the other application's main class by
calling its construtor and passing varying parameters and execute it
directly?

Avoid using Runtime.exec() when ure can be more efficient with the
language itself.

Hope this helps!

Regards,
Ranganath
 

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,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top