Attempting to run adt from an SSH session results in:
Exception in thread "main" java.lang.InternalError: Can't connect to window server - not enough permissions.
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1605)
at java.awt.Toolkit.<clinit>(Toolkit.java:1627)
at java.awt.Dimension.<clinit>(Dimension.java:70)
...
Normally this can be fixed by passing -Djava.awt.headless=true
to java. However, adt spawns other java processes without this argument, so this solution doesn't work.
I was able to hack my way around by replacing /usr/bin/java with a shell script containing:
java.old -Djava.awt.headless=true "$@"
However, this affects all java processes running on this box, causing many other issues. There has to be a better way...
I just noticed there's an extremely simple work-around. I tested this on OS X, and although not exactly a solution, might be good enough. Just ensure that the user trying to adt over ssh has an open console session and adt will run fine.