Run adt (Adobe's AIR developer tool) from SSH
Question
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...
Solution
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.
OTHER TIPS
The only work arounds you tend to find are making the your Jenkins user an actual user on OSX.
I have been having to rely on setting up Jenkins as a normal user on my OSX build box. Even utilizing the Xvfb Jenkins plug-in does not help the problem. It's extremely frustrating.
There is a rather unhelpful thread from Adobe here:
There is another thread here for wrapping part of the job in a shell script:
https://groups.google.com/forum/?fromgroups=#!topic/fluint-discussions/tL6AEWKgDfw