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.....
Rhino - 07 Jan 2006 15:50 GMT
> if I want to run a java application from the same java application:
> meaning parent process spawns a child process, but passes different
[quoted text clipped - 17 lines]
> 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
Ranganath Kini - 08 Jan 2006 09:22 GMT
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