"John Keiser" <[EMAIL PROTECTED]> writes:
> > From: Brian Jones
> > Subject: Runtime.exec()
> >
> > Where is nativeExec(String[] cmd, String[] env) defined?
> > I know that Runtime.exec should create an instance of a subclass of
> > java.lang.Process.
> >
>
> Right now, there is none. Process is sort of independent of VM, so I didn't
> bother with it in my integration efforts. It would be a good thing to add.
> The best thing to do would actually be to add a package-private method
> "static Process Process.exec(String[] cmd, String[] env)" and call that from
> Runtime.exec(). If you want to make it native, you can.
>
> Does it have to return a subclass of Process, or can it return an instance
> of Process itself if it so desires? Will there ever be multiple *types* of
> processes running on the same machine?
>
> --John Keiser
My guess is that Sun subclassed Process into things like UNIXProcess,
WindowsProcess, MacOSProcess, OSXProcess, etc. Process itself is
basically an abstract class with a few abstract methods. The
constructor isn't abstract however and there is nothing in the
javadocs to indicate what it would do.
According to the javadoc for it, yes Runtime.exec should return a
subclass of Process.
The Process class is independent of the VM, but real processes are
dependent on the native platform. My guess would be to create a
package private subclass and add whatever you need to it to keep track
of children processes and native code to perform the exec, kill, and
redirection of stdin, stdout, and stderr.
Brian
--
|-------------------------------|Software Engineer
|Brian Jones |[EMAIL PROTECTED]
|[EMAIL PROTECTED] |http://www.nortel.net
|http://www.classpath.org/ |------------------------------