This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: gcj: error trying to exec 'ecj1': execvp
David Michel wrote:
> Thanks it compiles fine now, but now I get an Exception at runtime:
>
> Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit:
> 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:114)
> at nl.kbna.dioscuri.GUI.<init>(dioscuri)
> at nl.kbna.dioscuri.GUI.<init>(dioscuri)
> at nl.kbna.dioscuri.GUI.main(dioscuri)
> Caused by: java.lang.ClassNotFoundException:
> at java.lang.Class.forName(natClass.cc:101)
> at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:583)
> ...7 more
>
> I simply run this for all the java source code to produce the object files:
> /local/gcc-4_4-branch/install/bin/gcj -O0 -g0 -c "--classpath=./:"
> foo.java -o foo.o
>
> and then, link them together with:
> /local/gcc-4_4-branch/install/bin/gcj -O0 -g0 --main=GUI foo1.o
> foo2.o..... -o ./a.out
>
> Obviously, it seems that it cannot find AWT, but I don't know why and
> how to solve this.
http://gcc.gnu.org/install/configure.html
AWT-Specific Options
--with-x
Use the X Window System.
--enable-java-awt=PEER(S)
Specifies the AWT peer library or libraries to build alongside
`libgcj'. If this option is unspecified or disabled, AWT will be
non-functional. Current valid values are gtk and xlib. Multiple
libraries should be separated by a comma
(i.e. --enable-java-awt=gtk,xlib).
I'd use gtk.
Andrew.