Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #24647 > unrolled thread
| Started by | "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> |
|---|---|
| First post | 2013-07-05 04:13 -0700 |
| Last post | 2013-07-05 04:17 -0700 |
| Articles | 2 — 1 participant |
Back to article view | Back to comp.lang.java.programmer
correctly setting system environment variables before calling Process.exec "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-07-05 04:13 -0700
Re: correctly setting system environment variables before calling Process.exec "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-07-05 04:17 -0700
| From | "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> |
|---|---|
| Date | 2013-07-05 04:13 -0700 |
| Subject | correctly setting system environment variables before calling Process.exec |
| Message-ID | <b499dc2e-1935-4aeb-8885-1ff1091af027@googlegroups.com> |
I have a program that needs to set the DISPLAY environment variable before calling an external program so it will display correctly on remote X-Windows machines. Note I *DO NOT* want it to be headerless i.e. I specifically can not and should not do java -Djava.awt.headless=true. The reason is the program *MUST* run in a interactive xterm on the remote machine. Here is something I tried with a no go:
import java.util.*;
public class Foo
{
public static void main(String[] args)
throws Throwable
{
Set<Map.Entry<String,String>> env=System.getenv().entrySet();
String[] envOut=new String[env.size()+1];
int i=0;
for(Map.Entry<String,String> e:env)
envOut[i++]=e.toString();
envOut[i]="DISPLAY=192.168.0.2:0.0";
Runtime.getRuntime().exec("xterm",envOut);
}
}
[toc] | [next] | [standalone]
| From | "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> |
|---|---|
| Date | 2013-07-05 04:17 -0700 |
| Message-ID | <c02b5ee0-eb0a-4850-9288-1d69a316fe14@googlegroups.com> |
| In reply to | #24647 |
Never mind I had the wrong IP for the actual value
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web