Find the answer to your Linux question:
Results 1 to 5 of 5
hey..so i downloaded jdk 1.5 on my kubuntu..now i compile and run java apps normally on this OS simulator called OSP2..anyway its manual says that i have to set a ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    60

    compiling and running java applications

    hey..so i downloaded jdk 1.5 on my kubuntu..now i compile and run java apps normally on this OS simulator called OSP2..anyway its manual says that i have to set a PATH variable for bash by placing the following in the .bashrc file in the home directory:
    PATH=/usr/local/bin/jdk:$PATHexport PATH

    anyway, i tried appending that line of code to the end of that file, and when i tried doing this on the terminal:
    Code:
    java -cp .:Demo.jar osp.OSP
    it gave me this list of errors
    Code:
    Initializing GUI, please wait ...
    Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
       at java.awt.Toolkit.getDefaultToolkit(libgcj.so.70)
       at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(libgcj.so.70)
       at java.awt.Window.<init>(libgcj.so.70)
       at java.awt.Frame.<init>(libgcj.so.70)
       at javax.swing.JFrame.<init>(libgcj.so.70)
       at osp.l.g.int(Unknown Source)
       at osp.l.g.for(Unknown Source)
       at osp.l.g.a(Unknown Source)
       at osp.l.g.<init>(Unknown Source)
       at osp.e.c.goto(Unknown Source)
       at osp.OSP.main(Unknown Source)
    Caused by: java.lang.UnsatisfiedLinkError: libgtkpeer: libgtkpeer.so: cannot open shared object file: No such file or directory
       at java.lang.Runtime._load(libgcj.so.70)
       at java.lang.Runtime.loadLibrary(libgcj.so.70)
       at java.lang.System.loadLibrary(libgcj.so.70)
       at gnu.java.awt.peer.gtk.GtkToolkit.<clinit>(libgcj.so.70)
       at java.lang.Class.initializeClass(libgcj.so.70)
       at java.lang.Class.forName(libgcj.so.70)
       at java.awt.Toolkit.getDefaultToolkit(libgcj.so.70)
       ...10 more
    so im guessing that the problem is with jdk not being recognized by the OS..any ideas?..and if u dont know about osp2, any ideas on how i can introduce jdk1.5 to kubuntu and compile and run java apps normally?...any help would be appreciated..

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Here is a guide to installing Java on Ubuntu (from the Ubuntu wiki):
    https://help.ubuntu.com/community/Java

    You want to install the Sun JDK.

    The error you are getting involves the use of some nonstandard library with Java, and can probably be solved somehow by modifying the CLASSPATH. However, I suggest installing Java natively (and not through a simulator) before trying anything else.
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Posts
    60
    what do u mean natively?...i downloaded the jdk1.5 and installed it on the desktop..it was a bin file and i unpacked it using the normal ./jdk.bin...is that what u mean by natively?..and another thing..i read something about modifying the PATH variable..how can we do that exactly?

  4. #4
    Just Joined!
    Join Date
    Oct 2007
    Posts
    60
    never mind..it worked..i figured out how to modify the PATH variable in .bashrc..thanks

  5. #5
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    By putting the "export PATH" on a separate line?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...