Re: Running AWT/SWING apps on embedded system

Top Page

Reply to this message
Author: ffileppo
Date:  
To: tromey
CC: java
Subject: Re: Running AWT/SWING apps on embedded system

> Francesco> I would like to run some sample AWT/SWING java code
> Francesco> compiled with gcj on my embedded box (an arm-based board
> Francesco> with a LCD screen).
>
> Francesco> I'm quite confused about what graphical libraries are
> Francesco> needed to do that, something like directfb or qt embedded?
>
> Francesco> Which is the best choice for an embedded box?
>
> My recollection is that the best-supported AWT peers are based on
> Gtk. This may be too heavy for your use case, I'm not sure.
>
> There are some other peer implementations in there, but I don't think
> they are as complete. I guess you'd have to experiment a bit, or
> maybe ask on the Classpath list -- the folks working on the non-Gtk
> back ends are more active over there.
>
> Tom
>


Hi Tom,

thanks for your help.
Would you give me some precise reference about non-gtk backends? I can't find any usefull info..

This is the error I get when I try to run on my embedded box some AWT/SWING code compiled with gcj:

Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit:
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.9)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(libgcj.so.9)
at java.awt.Window.<init>(libgcj.so.9)
at java.awt.Frame.<init>(libgcj.so.9)
at javax.swing.JFrame.<init>(libgcj.so.9)
at ActionExample.<init>(ActionSwing)
at ActionExample.main(ActionSwing)
Caused by: java.lang.ClassNotFoundException:
at java.lang.Class.forName(libgcj.so.9)
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.9)
...6 more


How can I set which AWT peer classpath will be using?

I'm getting a very similar error when I try to run the same code using jamvm (which uses classpath too):

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(GraphicsEnvironme
nt.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 ActionExample.<init>(ActionExample.java:79)
at ActionExample.main(ActionExample.java:118)
Caused by: java.lang.UnsatisfiedLinkError: Native library `gtkpeer' not found (a
s 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)
...6 more


I see that in this case it is looking for a particular peer (gtkpeer)

Francesco