I have a strange problem setting the Linux environment from Java (1.6); specifically the \"PATH\" variable.
In a nutshell, I have a pipeline for running native proce
I don't think it's a bug, I think it's a problem with your understanding of the boundaries and roles of the environment variables at play. ProcessBuilder.environment()
contains environment variables that will be "process-local" to the spawned process. They are not system-wide, or logon-wide, and they don't even affect the environment in which the ProcessBuilder is running.
The ProcessBuilder.environment()
map contains process-local variables that will be seen only by the spawned process. Obviously a prerequisite to the spawned processing seeing the ProcessBuilder.environment()
is successful spawning of the process, which is a point I do not think you're even getting to.
As far as I know, it's not really possible (from Java) to modify the currently-running process' PATH, which is what I think you're expecting to happen (or to be able to do.) So I think you must point ProcessBuilder to the fully qualified path to the executable you're trying to launch (or be certain that the PATH was set up correctly before you even launch the JVM that will use the ProcessBuilder, which is what you did in your 'working' scenario of setting it in the terminal before launching your IDE).