Mikael Gustafsson
July 9th, 2006, 07:41 PM
I have a problem when i try to compile this program below:
import javax.swing.*;
public class GameWindow {
public static void main(String[] args) {
JFrame mainWindow = new JFrame("test");
mainWindow.setSize(300, 200);
mainWindow.setVisible(true);
}
}
I get this error from eclips 3.2 when i try to run it.
Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.7)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvir onment(libgcj.so.7)
at java.awt.Window.<init>(libgcj.so.7)
at java.awt.Frame.<init>(libgcj.so.7)
at javax.swing.JFrame.<init>(libgcj.so.7)
at GameWindow.main(GameWindow.java:8)
Caused by: java.lang.ClassNotFoundException: gnu.java.awt.peer.gtk.GtkToolkit
at java.lang.Class.forName(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.7)
...5 more
I have installed sun-java5-bin and Installed the j2re1.4 package. And i have run the command
sudo update-alternatives --config java
and updated this so it is to sun-java5.
But still i have the problem with the JFrame program. I can run hello world program with out problems.
Can anyone help me?
/Mikael Gustafsson
import javax.swing.*;
public class GameWindow {
public static void main(String[] args) {
JFrame mainWindow = new JFrame("test");
mainWindow.setSize(300, 200);
mainWindow.setVisible(true);
}
}
I get this error from eclips 3.2 when i try to run it.
Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.7)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvir onment(libgcj.so.7)
at java.awt.Window.<init>(libgcj.so.7)
at java.awt.Frame.<init>(libgcj.so.7)
at javax.swing.JFrame.<init>(libgcj.so.7)
at GameWindow.main(GameWindow.java:8)
Caused by: java.lang.ClassNotFoundException: gnu.java.awt.peer.gtk.GtkToolkit
at java.lang.Class.forName(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at java.awt.Toolkit.getDefaultToolkit(libgcj.so.7)
...5 more
I have installed sun-java5-bin and Installed the j2re1.4 package. And i have run the command
sudo update-alternatives --config java
and updated this so it is to sun-java5.
But still i have the problem with the JFrame program. I can run hello world program with out problems.
Can anyone help me?
/Mikael Gustafsson