Java Gui

From Gumstix User Wiki
Jump to: navigation, search

Java GUI Howto

  • note: I am a linux newbie. The following steps are how I enabled the Java GUI functionality and may not be the correct way for everybody. If you know that one of these steps are bad, please correct it.

1) Add jamvm to the gumstix-x11-image and compile/download to gumstix. - modify (ROOT)/gumstix-oe/com.gumstix.collection/packages/images/ and add jamvm to the IMAGE_INSTALL list - follow the steps at this howto to compile and download image to gumstix

2) Add the GUI libs - If you try to run a java GUI app now, it will print the error

  java.awt.AWTError: Cannot load AWT toolkit:
     at java.awt.Toolkit.getDefaultToolkit(
     at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(
     at java.awt.Window.<init>(
     at java.awt.Frame.<init>(
     at javax.swing.JFrame.<init>(
     at HelloJavaWorld.main(
  Caused by: java.lang.UnsatisfiedLinkError: Native library `gtkpeer' not found (as file `') in gnu.classpath.boot.library.path and java.library.path
     at java.lang.Runtime.loadLibrary(
     at java.lang.System.loadLibrary(
     at java.lang.VMClass.forName(Native Method)
     at java.lang.Class.forName(
     at java.awt.Toolkit.getDefaultToolkit(
     ...5 more

- you must add and Both are located in the directory (ROOT)/gumstix-oe/tmp/work/armv5te-angstrom-linux-gnueabi/classpath-0.96.1-r2/install/classpath-gtk/usr/lib/classpath put it in /usr/lib/classpath directory on the gumstix. scp root@<IP>:/usr/lib/classpath works, or any other method

3) run ldconfig


4) point to display 0.0. You can do this by typing the line

  export DISPLAY=:0.0

before executing java

Adding Classpath with GUI support to your image

I enabled the GUI support by adding the two classpath lines to the INSTALL part of the image I use (, like so:

  # multiple lines removed to shorten this text...
   classpath \
   classpath-awt \
   jamvm \

Consider making a user.collection recipe of your changes to not get conflicts when the repository is updated.