How To Make Java Swing work on Beryl with AIGLX

Well considering the beryl project has no way as of yet to display Swing widgets (combo boxes, drop down menus etc.) display themselves using Sun’s JDK alternate means have to be made use of, so that Java applications can be executed.

Currently the problem seems to lie with Sun’s implementation of Swing and often the problem can be circumvented by utilizing another JDK such blackdown. This can be done in gentoo by doing,

# emerge -va dev-java/blackdown-jdk

# eselect java-vm list

Available Java Virtual Machines:
[1] blackdown-jdk-1.4.2
[2] sun-jdk-1.5
$ eselect java-vm set user 1

Note # represents the root prompt and $ the user prompt. If you wish to set system java-vm you must execute as root (#). The numbers shown above might vary and should be adjusted accordingly.

This solution has a problem… the blackdown JDK is only a 1.4.2 implementation (as of the time of this post) and Java 1.5.0 based applications will not execute. This can potentially be solved by utilizing another open source Java 5 implementation such as dev-java/ibm-jdk-bin (not tested yet).

Another sure shot way of solving this is to utilize a nested X server. The manner in which this works is to launch another X server inside our current one, except this time the nested X server does not have Beryl running inside it and hence does not face the problem we are currently encountering.

Initially a nested X server must be created. This can be done by,

$ screen Xnest :[display number] -ac -geometry

[display number] represents the number we assign to the X server instance and represents the resolution. Eg. to created a nested X server with a display number of 1 and of resolution 1440×900 we would use,

$ screen Xnest :1 -ac -geometry 1440×900

Now that the X server is created in a screen session we detatch from it by pressing the key combination control+alt+a. If you do not have screen you can merely launch it in a console window using the same command without adding the screen prefix.

Every application that is to be launched within the X server must now be told of the display number assigned to it. An application can be started in the nested X server by,

$ DISPLAY=:[display number] [path to app]

The [display number] is the display number we assigned to the nested X server previously and [path to app] is the path to the application we wish to execute in the nested X server. Eg. To execute the application frostwire (located at /usr/bin/frostwire) on a nested X server running on DISPLAY 1 we use the command,

$ DISPLAY=:1 /usr/bin/frostwire

This application can be executed in the background by using a screen command as shown previously.

Good luck and hope the Beryl team works on compatibility so this hassle has to no longer be encountered.


About this entry