Name: rmT116609 Date: 08/01/2001
Please add full support for creating new processes by extending the
functionality of items such as Runtime.exec. The addition of being able to
change the current working directory of a subprocess has been very helpful, but
more needs to be done. There are two items that come to mind for my work:
#1: I need a way to create a "detached", or "background", process that will
continue to run even after the Java VM exits.
#2: I need a way to *copy* the current execution environment, modify it, and
pass that onto the subprocess.
For #1, this is needed in order to spawn extra JVMs (starting multiple server
processes, third party Java apps, etc) with differing classpaths from the
current JVM. This also keeps any problems with the other applications from
affecting mine or each other. I also want to provide management of non-Java
applications, such as starting and stopping database servers, etc.
For #2, now that System.getenv() has been killed, the only way I have to get
platform environment variables is by having them specified on the java command
line. When I want to spawn a subprocess with a slightly altered environment, I
have no easy way of doing this.
For instance, if I call Runtime.exec with an environment of just CLASSPATH=xxx,
that is the entire environment for the subprocess. I understand that this is how
it is supposed to work and therefore is not a bug. However, since the subprocess
has not inherited the previous environment, it can be severely limited. For
instance, with no DISPLAY variable and other X authorization variables, the
subprocess cannot even access the display system.
To work around this, I would have to pass every single environment variable set
on the system to -D parameters on the java command line so that I could then
gather them all up to send to the subprocess. This is not only ridiculous, it
can quickly overextend some systems' maximum command line lengths.
Unfortunately, the more I work on this, the more I'm realizing that it would be
easier to write separate applications in C/C++ for each supported platform than
it is to try to get Java to do this. It is very easy to make application
management programs in nearly every other language besides Java. I hope that
this soon changes.
(Review ID: 129188)
======================================================================
- duplicates
-
JDK-4109888 (process spec) Semantics of external process is not defined in JLS
- Closed