Need help with Unsatisfied Link Error

Discussion in 'Java' started by Ten Blade, Jul 15, 2011.

  1. Ten Blade

    Ten Blade Guest

    I am trying to make a start with UNO, the Open Office Org technology for
    writing OOO documents via Java programs. Unfortunately, I'm having
    trouble with my very first program and not finding any help on the OOO
    forums.

    Here's the stacktrace that I get when I try to run the program using the
    Ant script that they supply:

    run:
    [java] Exception in thread "main" java.lang.UnsatisfiedLinkError: no
    unowinreg in java.library.path
    [java] at java.lang.ClassLoader.loadLibrary(Unknown Source)
    [java] at java.lang.Runtime.loadLibrary0(Unknown Source)
    [java] at java.lang.System.loadLibrary(Unknown Source)
    [java] at com.sun.star.lib.loader.WinRegKey.<clinit>
    (WinRegKey.java:90)
    [java] at
    com.sun.star.lib.loader.InstallationFinder.getPathFromWindowsRegistry
    (InstallationFinder.java:201)
    [java] at com.sun.star.lib.loader.InstallationFinder.getPath
    (InstallationFinder.java:109)
    [java] at com.sun.star.lib.loader.Loader.getCustomLoader
    (Loader.java:174)
    [java] at com.sun.star.lib.loader.Loader.main(Loader.java:134)

    BUILD FAILED
    C:\eclipse\workspace\FirstUnoContact\build.xml:62: Java returned: 1


    I have no idea what unowinreg is or does but I did manage to find it - I
    think. There is a unowinreg.dll in a cab file called openofficeorg1.cab.
    That cab file is in the OOO 3.3 SDK. I'm guessing that that's what my
    program needs to find to run successfully.

    To start with, I don't know if a Java program can use a dll that is
    sitting in a cab file. I've never come across that situation before. Can
    anyone tell me if that is even theoretically possible? Perhaps there is
    another unowinreg somewhere else and this one is a red herring?

    If it _is_ possible, can anyone tell me how to make that dll visible to
    my program at run time? I've tried adding the cab file to the Eclipse
    project in the Properties/Build Path/Libraries window but the 'run' step
    still fails on the same error. I've also tried adding -Djava.library.path
    VM argument to the Ant script that contained the 'run' target but that
    failed too. I got the exact same error in both situations.

    I'm running on Windows XP SP2 using Eclipse 3.7 (Indigo).

    --
    Ten-Blade
    Ten Blade, Jul 15, 2011
    #1
    1. Advertising

  2. Ten Blade

    Roedy Green Guest

    On Fri, 15 Jul 2011 03:35:32 +0000 (UTC), Ten Blade
    <> wrote, quoted or indirectly quoted someone
    who said :

    >UnsatisfiedLinkError:


    These are surprisingly difficult to track down. See
    http://mindprod.com/jgloss/runerrormessages.html#UNSATISFIEDLINKERROR
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    One thing I love about having a website, is that when I complain about
    something, I only have to do it once. It saves me endless hours of grumbling.
    Roedy Green, Jul 15, 2011
    #2
    1. Advertising

  3. Ten Blade

    Rhino Guest

    "Roedy Green" <> wrote in message
    news:...
    > On Fri, 15 Jul 2011 03:35:32 +0000 (UTC), Ten Blade
    > <> wrote, quoted or indirectly quoted someone
    > who said :
    >
    >>UnsatisfiedLinkError:

    >
    > These are surprisingly difficult to track down. See
    > http://mindprod.com/jgloss/runerrormessages.html#UNSATISFIEDLINKERROR



    Something really critical for me to know here is whether it is indeed
    possible for a Java program to link with a DLL in a cab file. I'm not even
    positive I have the right file so I'd like to be sure that linking to the
    DLL is possible in the first place, particularly when it is within a cab
    file. Perhaps I need to copy it from the cab file into a directory? Or can
    Java 'see' DLLs in a cab file the same way it can read class files in a jar?

    I'm running Windows XP SP2.

    --
    Rhino
    Rhino, Jul 15, 2011
    #3
  4. On 15/07/2011 15:04, Rhino wrote:
    >
    > "Roedy Green" <> wrote in message
    > news:...
    >> On Fri, 15 Jul 2011 03:35:32 +0000 (UTC), Ten Blade
    >> <> wrote, quoted or indirectly quoted someone
    >> who said :
    >>
    >>> UnsatisfiedLinkError:

    >>
    >> These are surprisingly difficult to track down. See
    >> http://mindprod.com/jgloss/runerrormessages.html#UNSATISFIEDLINKERROR

    >
    >
    > Something really critical for me to know here is whether it is indeed
    > possible for a Java program to link with a DLL in a cab file.


    As I understand it, Windows cabinet files (.cab) are intended for use by
    an application installer, not by another application. The installer
    would normally extract DLLs from a cabinet file and install them into
    the correct place.

    For this reason I'd be surprised if JNI had some general way of knowing
    which cab files might contain a needed DLL.


    > I'm not
    > even positive I have the right file so I'd like to be sure that linking
    > to the DLL is possible in the first place, particularly when it is
    > within a cab file. Perhaps I need to copy it from the cab file into a
    > directory? Or can Java 'see' DLLs in a cab file the same way it can read
    > class files in a jar?


    "Java Uno is the implementation of Uno (Runtime, Core Components,
    utilities) for Java. Java Uno interoperates with Binary Uno via the JNI
    - Binary Uno bridge"

    Are you certain you have properly 0installed Binary UNO?

    --
    RGB
    RedGrittyBrick, Jul 15, 2011
    #4
  5. Ten Blade

    Ten Blade Guest

    RedGrittyBrick <> wrote in
    news:4e204dc8$0$2490$:

    > On 15/07/2011 15:04, Rhino wrote:
    >>
    >> "Roedy Green" <> wrote in message
    >> news:...
    >>> On Fri, 15 Jul 2011 03:35:32 +0000 (UTC), Ten Blade
    >>> <> wrote, quoted or indirectly quoted someone
    >>> who said :
    >>>
    >>>> UnsatisfiedLinkError:
    >>>
    >>> These are surprisingly difficult to track down. See
    >>> http://mindprod.com/jgloss/runerrormessages.html#UNSATISFIEDLINKERROR

    >>
    >>
    >> Something really critical for me to know here is whether it is indeed
    >> possible for a Java program to link with a DLL in a cab file.

    >
    > As I understand it, Windows cabinet files (.cab) are intended for use
    > by an application installer, not by another application. The installer
    > would normally extract DLLs from a cabinet file and install them into
    > the correct place.
    >

    Sounds reasonable. I had a vague sense that user programs don't access
    files from cab files from the first but didn't know enough to be
    sure....


    > For this reason I'd be surprised if JNI had some general way of
    > knowing which cab files might contain a needed DLL.
    >


    Sounds reasonable.

    >
    >> I'm not
    >> even positive I have the right file so I'd like to be sure that
    >> linking to the DLL is possible in the first place, particularly when
    >> it is within a cab file. Perhaps I need to copy it from the cab file
    >> into a directory? Or can Java 'see' DLLs in a cab file the same way
    >> it can read class files in a jar?

    >
    > "Java Uno is the implementation of Uno (Runtime, Core Components,
    > utilities) for Java. Java Uno interoperates with Binary Uno via the
    > JNI - Binary Uno bridge"
    >
    > Are you certain you have properly 0installed Binary UNO?
    >


    Excellent question but I'm not sure how to answer it. I know virtually
    nothing about UNO and how it works, just that it was a technique I saw
    recommended to meet my needs of creating documents that could be read by
    Word.

    I can't find anything in the way of documentation telling you exactly
    how the UNO SDK is to be installed but, on the chance that I chose an
    inappropriate option during the installation the first time, I
    uninstalled the SDK completely and then reinstalled it. There was really
    just one option during the install, namely where it was supposed to be
    installed relative to OpenOfficeOrg itself. I simply took the default
    value this time - as I think I did the first time too - and let it
    reinstall. I had no information on a better place to install it so that
    seems likely to be the right place.

    Once I'd reinstalled the SDK, I noticed that there was a unowinreg.dll
    in one of the folders in the SDK but this one was NOT in a cab file.
    Eureka, I thought! I noted the full path to unowinreg.dll but did
    nothing else about it for the moment.

    I tried preparing and running the program again but it failed on the
    same error; no surprise. I tried adding the path to the unowinreg.dll to
    the java.library.path but seem to have screwed it up because I couldn't
    get it to see the dll for love or money.

    Finally, I googled some more and saw the suggestion that as long as
    unowinreg.dll was in one of the folders specified in the
    java.library.path - it didn't matter which one - I should be good to go.
    I put it in an eclipse folder that was in the path, stopped and started
    Eclipse, but still got the error message. Then I deleted it from the
    eclipse folder and put a copy of unowinreg.dll in c:\windows\system32,
    rebooted the computer and NOW I can run the program successfully!
    Problem solved!!

    Thanks to you and Roedy for getting me going in the right direction!!

    Now I can finally start to learn about UNO!
    --
    Ten-Blade
    Ten Blade, Jul 15, 2011
    #5
  6. Ten Blade

    Roedy Green Guest

    On Fri, 15 Jul 2011 10:04:09 -0400, "Rhino"
    <> wrote, quoted or indirectly
    quoted someone who said :

    >particularly when it is within a cab
    >file


    Even if you could, it would slow down DLL load considerably since they
    are compressed. Look for DLLs on the path, and the library path you
    can determine with system properties.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    One thing I love about having a website, is that when I complain about
    something, I only have to do it once. It saves me endless hours of grumbling.
    Roedy Green, Jul 16, 2011
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    9
    Views:
    714
    Steve W. Jackson
    Jan 16, 2004
  2. allelopath
    Replies:
    1
    Views:
    7,312
    P. Barthelemy
    Jan 4, 2005
  3. Replies:
    1
    Views:
    22,286
    Kari Ikonen
    Feb 6, 2005
  4. cppaddict
    Replies:
    4
    Views:
    20,246
    Gordon Beaton
    May 20, 2005
  5. Dag Sunde
    Replies:
    8
    Views:
    2,644
    Dag Sunde
    Jan 5, 2007
Loading...

Share This Page