Difference between revisions of "Java Gui"
Searchworks (Talk | contribs) (remove spam) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
1) Add jamvm to the gumstix-x11-image and compile/download to gumstix. | 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 | - 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 [http://www.gumstix.net/ | + | - follow the steps at [http://www.gumstix.net/User-How-To-s/view/Getting-started/Quick-start/110.html this howto] to compile and download image to gumstix |
Latest revision as of 15:32, 23 November 2010
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
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 (gumstix-x11-32mb-image.bb), like so:
IMAGE_INSTALL += " \ # 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.