Java Gui
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/gumstix-x11-image.bb 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: gnu.java.awt.peer.gtk.GtkToolkit at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:607) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:103) at java.awt.Window.<init>(Window.java:133) at java.awt.Frame.<init>(Frame.java:246) at javax.swing.JFrame.<init>(JFrame.java:123) at HelloJavaWorld.main(HelloJavaWorld.java:8) Caused by: java.lang.UnsatisfiedLinkError: Native library `gtkpeer' not found (as file `libgtkpeer.so') in gnu.classpath.boot.library.path and java.library.path at java.lang.Runtime.loadLibrary(Runtime.java:763) at java.lang.System.loadLibrary(System.java:662) at gnu.java.awt.peer.gtk.GtkToolkit.<clinit>(GtkToolkit.java:173) at java.lang.VMClass.forName(Native Method) at java.lang.Class.forName(Class.java:233) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:583) ...5 more
- you must add libgtkpeer.so and libjawt.so. 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 libgtkpeer.so libjawt.so root@<IP>:/usr/lib/classpath works, or any other method
3) run ldconfig
root@...$ ldconfig
4) point to display 0.0. You can do this by typing the line
root@...$ export DISPLAY=:0.0
<code> before executing java