Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: java.lang.UnsatisfiedLinkError

  1. #1
    Join Date
    Mar 2009
    Beans
    9

    java.lang.UnsatisfiedLinkError

    Hi,

    I'm trying to run a simple java program I compiled for class. This is the first time i've run a program that imports the javax.swing.JOptionPane since I installed Ubuntu 8.10 and java.

    I get this error when I try to run the program as: java TestGCalc

    Code:
    $ java TestGCalc
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1666)
    	at java.lang.Runtime.load0(Runtime.java:787)
    	at java.lang.System.load(System.java:1022)
    	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1767)
    	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1684)
    	at java.lang.Runtime.loadLibrary0(Runtime.java:840)
    	at java.lang.System.loadLibrary(System.java:1047)
    	at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
    	at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.awt.Toolkit.loadLibraries(Toolkit.java:1610)
    	at java.awt.Toolkit.<clinit>(Toolkit.java:1632)
    	at java.awt.Component.<clinit>(Component.java:568)
    	at TestGCalc.printMenu(TestGCalc.java:34)
    	at TestGCalc.main(TestGCalc.java:13)
    From what I've seen through other posts is that java isn't able to find

    /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so

    when I went to check, obviously it wasn't there. Am I missing libraries that need to be installed? if so what packages are they in?

    Thanks for your help

  2. #2
    Join Date
    May 2008
    Beans
    Hidden!

    Re: java.lang.UnsatisfiedLinkError

    Handy little program:

    Code:
    $ apt-file search /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    openjdk-6-dbg: /usr/lib/debug/usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    openjdk-6-jre: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    Try installing that.

  3. #3
    Join Date
    Mar 2009
    Beans
    9

    Re: java.lang.UnsatisfiedLinkError

    I'm sorry, do you think you could give me a short explanation, I'm not sure what this is supposed to do.

    Thanks

  4. #4
    Join Date
    May 2008
    Beans
    Hidden!

    Re: java.lang.UnsatisfiedLinkError

    Quote Originally Posted by JordBrow View Post
    I'm sorry, do you think you could give me a short explanation, I'm not sure what this is supposed to do.
    Sorry, I was trying to demonstrate how I found the correct package.

    First, the exception. It tells us you're missing a library, so we have to find out what package it's in. There is a handy little program called apt-file (I don't know of a GUI equivalent, there might be one) that can search for files even in packages you don't have installed. So I used it to search for that file:

    Code:
    $ apt-file search /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    And it generated this output:

    Code:
    openjdk-6-dbg: /usr/lib/debug/usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    openjdk-6-jre: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    Which simply means the file we need is in the second package, openjdk-6-jre.

    Open System -> Administration -> Synaptic, and install this package.

    Then try running your program again, it should work.

  5. #5
    Join Date
    Mar 2009
    Beans
    9

    Re: java.lang.UnsatisfiedLinkError

    Thank you so much! worked like a charm!

  6. #6
    Join Date
    Feb 2008
    Beans
    5

    Re: java.lang.UnsatisfiedLinkError

    Thanks, this is just what I needed

    I had previously installed the openjdk-6-jre-headless package, but had missed the standard jre, obviously!

  7. #7
    Join Date
    Jun 2009
    Location
    Sweden
    Beans
    11
    Distro
    Ubuntu Studio 10.10 Maverick Meerkat

    Re: java.lang.UnsatisfiedLinkError

    Quote Originally Posted by snova View Post
    Handy little program:

    Code:
    $ apt-file search /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    openjdk-6-dbg: /usr/lib/debug/usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    openjdk-6-jre: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
    Try installing that.


    Thanks m8
    solved my head bump you s

  8. #8
    Join Date
    Apr 2009
    Location
    Mangalore India
    Beans
    803
    Distro
    Lubuntu 16.04 Xenial Xerus

    Re: java.lang.UnsatisfiedLinkError

    Thanks Snova
    With regards
    Dr Kurian
    Microsoft gives you Windows... Linux gives you the whole house.

  9. #9
    Join Date
    Aug 2010
    Beans
    1

    Re: java.lang.UnsatisfiedLinkError

    Thanks a lot, Snova!

  10. #10
    Join Date
    Nov 2009
    Location
    Virginia
    Beans
    11
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Talking Re: java.lang.UnsatisfiedLinkError

    Quote Originally Posted by snova View Post

    Then try running your program again, it should work.
    Thank you so so so so much, snova! I have been chipping away at Eclipse and Tomcat issues on 10.10 for a day (ok, only a few hours over a couple of days but still). Thank you for helping me get back to what I wanted to do -- stop messing with server foo and get back to coding foo!

    =D>

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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