Difference between revisions of "Java Gui"
Searchworks (Talk | contribs) (correct link) |
Aqisecoxefi (Talk | contribs) |
||
Line 1: | Line 1: | ||
+ | ---- | ||
+ | <div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;"> | ||
+ | ---- | ||
+ | =[http://orylyvejuza.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]= | ||
+ | ---- | ||
+ | =[http://orylyvejuza.co.cc CLICK HERE]= | ||
+ | ---- | ||
+ | </div> | ||
== Java GUI Howto == | == 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. | *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. | ||
Line 10: | Line 18: | ||
- If you try to run a java GUI app now, it will print the error | - If you try to run a java GUI app now, it will print the error | ||
− | + | <code> | |
java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit | java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit | ||
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:607) | at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:607) | ||
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:103) | at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:103) | ||
− | at java.awt.Window.<init>(Window.java:133) | + | at java.awt.Window.&lt;init&gt;(Window.java:133) |
− | at java.awt.Frame.<init>(Frame.java:246) | + | at java.awt.Frame.&lt;init&gt;(Frame.java:246) |
− | at javax.swing.JFrame.<init>(JFrame.java:123) | + | at javax.swing.JFrame.&lt;init&gt;(JFrame.java:123) |
at HelloJavaWorld.main(HelloJavaWorld.java:8) | 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 | 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.Runtime.loadLibrary(Runtime.java:763) | ||
at java.lang.System.loadLibrary(System.java:662) | at java.lang.System.loadLibrary(System.java:662) | ||
− | at gnu.java.awt.peer.gtk.GtkToolkit.<clinit>(GtkToolkit.java:173) | + | at gnu.java.awt.peer.gtk.GtkToolkit.&lt;clinit&gt;(GtkToolkit.java:173) |
at java.lang.VMClass.forName(Native Method) | at java.lang.VMClass.forName(Native Method) | ||
at java.lang.Class.forName(Class.java:233) | at java.lang.Class.forName(Class.java:233) | ||
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:583) | at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:583) | ||
...5 more | ...5 more | ||
− | + | </code> | |
- you must add libgtkpeer.so and libjawt.so. Both are located in the directory | - 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''' | '''(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. | put it in /usr/lib/classpath directory on the gumstix. | ||
− | ''scp libgtkpeer.so libjawt.so root@ | + | ''scp libgtkpeer.so libjawt.so root@<IP>:/usr/lib/classpath'' works, or any other method |
3) run ldconfig | 3) run ldconfig | ||
− | + | <code> | |
ldconfig | ldconfig | ||
− | + | </code> | |
4) point to display 0.0. You can do this by typing the line | 4) point to display 0.0. You can do this by typing the line | ||
− | + | <code> | |
export DISPLAY=:0.0 | export DISPLAY=:0.0 | ||
− | + | </code> | |
before executing java | before executing java | ||
Line 52: | Line 60: | ||
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: | 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 += | + | IMAGE_INSTALL += " \ |
# multiple lines removed to shorten this text... | # multiple lines removed to shorten this text... | ||
classpath \ | classpath \ | ||
classpath-awt \ | classpath-awt \ | ||
jamvm \ | jamvm \ | ||
− | + | " | |
Consider making a user.collection recipe of your changes to not get conflicts when the repository is updated. | Consider making a user.collection recipe of your changes to not get conflicts when the repository is updated. | ||
[[Category:How_to_-_JAVA]] | [[Category:How_to_-_JAVA]] |
Revision as of 14:45, 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
<code>
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
</code>
- 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
<code>
ldconfig
</code>
4) point to display 0.0. You can do this by typing the line
<code>
export DISPLAY=:0.0
</code> 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.