| Author |
Setting ksh enviroment variables from Java
|
Adam J Smith
Greenhorn
Joined: Apr 23, 2008
Posts: 20
|
|
I have an application that will run in ksh that needs to set environment variables for another process to run. I have tried I also tried to create a shell script that takes two args and sets them to environment. When I run I get When I run nothing happens. I know another possibility is to use ProcessBuilder but I can find an example. [ December 19, 2008: Message edited by: Adam J Smith ]
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24041
|
|
Each time you call exec(), you're starting a new process; any changes made to the environment variables in a process will affect only that one process and its own children, not any other process you start with exec(). There are several Runtime.exec() methods; several of them take a String[] argument called "envp", which lets you pass environment variables to the process you're launching.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Adam J Smith
Greenhorn
Joined: Apr 23, 2008
Posts: 20
|
|
|
I was hoping I wouldn't have to do something like that. I am doing some maintenance on an old, and very poorly designed swing gui. The easiest solution seemed to be to set environment variables for the parent. I guess that may not be possible. Thanks.
|
 |
 |
|
|
subject: Setting ksh enviroment variables from Java
|
|
|