removing or using AWT/Swing

Marco Trudel mtrudel@gmx.ch
Wed Jul 26 09:26:00 GMT 2006


Hello list
I played a little with AWT/Swing with a 4.2.0 gcj (20060630, 
experimental). There raised two questions:
1:
As Ranjit pointed out here: 
http://gcc.gnu.org/ml/java/2006-07/msg00033.html, a simple 
System.out.println application pulls in the whole AWT lib.
So I assumed disabling AWT will make the executables smaller and gave it 
a try. I compiled gcc with "--without-x --disable-java-awt", but I saw 
multiple lines that told about compiling AWT and Swing stuff.
A compiled System.out.println() with this gcj build has the exact same 
size as with a gcj that wasn't compiled with "--without-x 
--disable-java-awt".
What do I miss? I really would have expected a smaller executable...
2:
I wanted to check the current status of AWT/Swing. I tried with a gcj 
that wasn't compiled with any special AWT flag. A simple AWT frame gave 
this exception (I'm working on linux, awt is the executable name):
Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit: 
gnu.java.awt.peer.gtk.GtkToolkit
 at java.awt.Toolkit.getDefaultToolkit(awt)
 at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(awt)
 at java.awt.Window.<init>(awt)
 at java.awt.Frame.<init>(awt)
 at java.awt.Frame.<init>(awt)
 at HelloWorld.<init>(awt)
 at HelloWorld.main(awt)
Caused by: java.lang.ClassNotFoundException: 
gnu.java.awt.peer.gtk.GtkToolkit not found in 
gnu.gcj.runtime.SystemClassLoader{urls=[file:./], 
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
 at java.net.URLClassLoader.findClass(awt)
 at java.lang.ClassLoader.loadClass(awt)
 at java.lang.ClassLoader.loadClass(awt)
 at java.lang.Class.forName(awt)
 at java.awt.Toolkit.getDefaultToolkit(awt)
 ...6 more
The installation manual points out, that I have to use --enable-java-awt 
or AWT will be non-functional. So I tried with a gcj that was compiled 
with "--enable-java-awt=gtk" but I got the same exception as above.
The only thing google has to say to this is that I should change to a 
SUN JVM :-(
So, am I doing anything wrong or is AWT/Swing broken in the used gcj 
version? (I think this gcj works with gnu classpath v0.9).
A general question to this: My impression of following the mailinglist 
and searching in the net is, that swingWT currently is more useful than 
AWT/Swing support from gnu classpath. Any other opinions on that?
thanks
Marco


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /