LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit (https://www.linuxquestions.org/questions/linux-newbie-8/java-awt-awterror-cannot-load-awt-toolkit-gnu-java-awt-peer-gtk-gtktoolkit-444240/)

artemis8543 05-12-2006 06:42 PM

java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
 
Hi, I just started using Ubuntu 6.06 LTS. When I try to execute a java program using the java ProgramName command, I get this error

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.getLocalGraphicsEnvironment(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 Driver.<init>(Driver.java:6)
at Caterpillar.main(Caterpillar.java:24)
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)
...6 more

but it works when i type in the entire path (/opt/jdk1.5.0_06/bin/java)

Compiling works without the entire path, so I think I added it to the PATH correctly...

me@mine:~$ export PATH="$PATH:/opt/jdk1.5.0_06/bin/"
me@mine:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/opt/jdk1.5.0_06/bin/

but then when I open a new terminal and do echo $PATH again, the last one isn't there.
What am I doing wrong/haven't I done?

Thanks a lot

mrcheeks 05-13-2006 12:58 PM

change
export PATH="$PATH:/opt/jdk1.5.0_06/bin/"
by
export PATH="/opt/jdk1.5.0_06/bin/:$PATH"

artemis8543 05-13-2006 05:10 PM

Thanks, that got rid of the error. But every time I open a new terminal I have to redo that command. Is there any way to make it permanent?

artemis8543 05-16-2006 07:35 PM

Could anybody help me with this?

mrcheeks 05-16-2006 08:38 PM

put the line
Code:

export PATH="/opt/jdk1.5.0_06/bin/:$PATH"
in the file /etc/profile


All times are GMT -5. The time now is 04:09 PM.