A
Aryeh M. Friedman
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="DISPLAY=192.168.0.2:0.0";
Runtime.getRuntime().exec("xterm",envOut);
}
}
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="DISPLAY=192.168.0.2:0.0";
Runtime.getRuntime().exec("xterm",envOut);
}
}