java 1.4 fail with java.lang.UnsatisfiedLinkError but 1.5, 1.6 ok

Discussion in 'Java' started by TsanChung, Jan 7, 2009.

  1. TsanChung

    TsanChung Guest

    My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    on a HP-UX B.11.23 U ia64 computer.
    Please help even though java 1.4 is old.

    $ /opt/java1.4/bin/java -d32 -jar jHw.jar
    Failed to load MycompAPI and MycompAPI_64 libraries.
    java.lang.UnsatisfiedLinkError: no MycompAPI_64 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1542)
    at java.lang.Runtime.loadLibrary0(Runtime.java:795)
    at java.lang.System.loadLibrary(System.java:834)
    at com.chrysalisits.crypto.MycompAPI.<clinit>(MycompAPI.java:
    47)
    at com.chrysalisits.crypto.MycompHwManager.<init>
    (MycompHwManager.java:101)
    at com.chrysalisits.crypto.MycompHwManager.getInstance
    (MycompHwManager.java:62)
    at jHw.jHw.<init>(jHw.java:32)
    at jHw.jHw.main(jHw.java:764)
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Initialize
    at com.chrysalisits.crypto.MycompAPI.Initialize(Native Method)
    at com.chrysalisits.crypto.MycompHwManager.<init>
    (MycompHwManager.java:107)
    at com.chrysalisits.crypto.MycompHwManager.getInstance
    (MycompHwManager.java:62)
    at jHw.jHw.<init>(jHw.java:32)
    at jHw.jHw.main(jHw.java:764)

    $ /opt/java1.4/bin/java -d32 -version
    java version "1.4.2.19"
    Java(TM) 2 Runtime Environment, Standard Edition (build
    1.4.2.19-080514-21:19)
    Java HotSpot(TM) Server VM (build 1.4.2 1.4.2.19-080515-02:54-IA64N
    IA64, mixed mode)

    $ /opt/java1.5/bin/java -d32 -version
    java version "1.5.0.13"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.13-
    _09_may_2008_11_35)
    Java HotSpot(TM) Server VM (build 1.5.0.13 jinteg:05.09.08-16:53 IA64,
    mixed mode)

    $ /opt/java6/bin/java -d32 -version
    java version "1.6.0.01"
    Java(TM) SE Runtime Environment (build 1.6.0.01-
    jinteg_06_jun_2008_13_24-b00)
    Java HotSpot(TM) Server VM (build 1.6.0.01 jinteg:06.07.08-04:50 IA64,
    mixed mode)
     
    TsanChung, Jan 7, 2009
    #1
    1. Advertising

  2. Re: java 1.4 fail with java.lang.UnsatisfiedLinkError but 1.5, 1.6ok

    TsanChung wrote:
    > My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    > on a HP-UX B.11.23 U ia64 computer.
    > Please help even though java 1.4 is old.
    >
    > $ /opt/java1.4/bin/java -d32 -jar jHw.jar
    > Failed to load MycompAPI and MycompAPI_64 libraries.
    > java.lang.UnsatisfiedLinkError: no MycompAPI_64 in java.library.path


    What this error means is that the library MycompAPI_64 (MycompAPI_64.so
    on *nix machines, MycompAPI_64.dll) cannot be found in the library path
    for Java 1.4.

    If you print out the System property "java.library.path" under all the
    versions, you can track down the location of the library and copy it to
    the 1.4 library path.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Jan 7, 2009
    #2
    1. Advertising

  3. TsanChung

    TsanChung Guest

    On Jan 7, 10:19 am, Joshua Cranmer <> wrote:
    > TsanChung wrote:
    > > My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    > > on a HP-UX B.11.23 U ia64 computer.
    > > Please help even though java 1.4 is old.

    >
    > > $ /opt/java1.4/bin/java -d32 -jar jHw.jar
    > > Failed to load MycompAPI and MycompAPI_64 libraries.
    > > java.lang.UnsatisfiedLinkError: no MycompAPI_64 in java.library.path

    >
    > What this error means is that the library MycompAPI_64 (MycompAPI_64.so
    > on *nix machines, MycompAPI_64.dll) cannot be found in the library path
    > for Java 1.4.
    >
    > If you print out the System property "java.library.path" under all the
    > versions, you can track down the location of the library and copy it to
    > the 1.4 library path.
    >
    > --
    > Beware of bugs in the above code; I have only proved it correct, not
    > tried it. -- Donald E. Knuth


    I had done this for java 1.6, 1.5 and 1.4 respectively but it did not
    solve "java.library.path" problem.
    export CLASSPATH=.:/opt/java6/jre/lib/ext
    export SHLIB_PATH=.:/opt/java6/jre/lib/ext

    export CLASSPATH=.:/opt/java1.5/jre/lib/ext
    export SHLIB_PATH=.:/opt/java1.5/jre/lib/ext

    export CLASSPATH=.:/opt/java1.4/jre/lib/ext
    export SHLIB_PATH=.:/opt/java1.4/jre/lib/ext
     
    TsanChung, Jan 7, 2009
    #3
  4. TsanChung

    TsanChung Guest

    On Jan 7, 10:53 am, TsanChung <> wrote:
    > On Jan 7, 10:19 am, Joshua Cranmer <> wrote:
    >
    >
    >
    > > TsanChung wrote:
    > > > My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    > > > on a HP-UX B.11.23 U ia64 computer.
    > > > Please help even though java 1.4 is old.

    >
    > > > $ /opt/java1.4/bin/java -d32 -jar jHw.jar
    > > > Failed to load MycompAPI and MycompAPI_64 libraries.
    > > > java.lang.UnsatisfiedLinkError: no MycompAPI_64 in java.library.path

    >
    > > What this error means is that the library MycompAPI_64 (MycompAPI_64.so
    > > on *nix machines, MycompAPI_64.dll) cannot be found in the library path
    > > for Java 1.4.

    >
    > > If you print out the System property "java.library.path" under all the
    > > versions, you can track down the location of the library and copy it to
    > > the 1.4 library path.

    >
    > > --
    > > Beware of bugs in the above code; I have only proved it correct, not
    > > tried it. -- Donald E. Knuth

    >
    > I had done this for java 1.6, 1.5 and 1.4 respectively but it did not
    > solve "java.library.path" problem.
    > export CLASSPATH=.:/opt/java6/jre/lib/ext
    > export SHLIB_PATH=.:/opt/java6/jre/lib/ext
    >
    > export CLASSPATH=.:/opt/java1.5/jre/lib/ext
    > export SHLIB_PATH=.:/opt/java1.5/jre/lib/ext
    >
    > export CLASSPATH=.:/opt/java1.4/jre/lib/ext
    > export SHLIB_PATH=.:/opt/java1.4/jre/lib/ext


    I had copied all the required files to /opt/java6/jre/lib/ext, /opt/
    java1.5/jre/lib/ext, /opt/java1.4/jre/lib/ext.

    java.library.path for java 1.4 is set up as:
    /opt/java1.4/jre/lib/IA64N:/opt/java1.4/jre/lib/IA64N/server:/opt/
    java1.4/jre/../lib/IA64N:.:/opt/java1.4/jre/lib/ext:/usr/lib

    Why java 1.4 still fail?
     
    TsanChung, Jan 7, 2009
    #4
  5. TsanChung

    TsanChung Guest

    On Jan 7, 11:12 am, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
    > TsanChung wrote:
    > > My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    > > on a HP-UX B.11.23 U ia64 computer.
    > > Please help even though java 1.4 is old.

    >
    > Which java version did you compile with?
    >
    >    BugBear


    I compiled with java 1.4.2.08 on another hpux computer and copied the
    files to this hpux computer.

    The build machine info are:
    # java -version

    java version "1.4.2.08"
    Java(TM) 2 Runtime Environment, Standard Edition (build
    1.4.2.08-050401-17:46)
    Java HotSpot(TM) Server VM (build 1.4.2 1.4.2.08-050401-19:15-
    PA_RISC1.1 PA1.1, mixed mode)

    # uname -a
    HP-UX hp2 B.11.00 U 9000/785 2003725330 unlimited-user license
     
    TsanChung, Jan 7, 2009
    #5
  6. TsanChung

    Roedy Green Guest

    On Wed, 7 Jan 2009 07:00:33 -0800 (PST), TsanChung
    <> wrote, quoted or indirectly quoted someone
    who said :

    >My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    >on a HP-UX B.11.23 U ia64 computer.
    >Please help even though java 1.4 is old.


    see http://mindprod.com/jgloss/jni.html

    Check the library path in both cases.

    Your native code must be on the library path.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    PM Steven Harper is fixated on the costs of implementing Kyoto, estimated as high as 1% of GDP.
    However, he refuses to consider the costs of not implementing Kyoto which the
    famous economist Nicholas Stern estimated at 5 to 20% of GDP
     
    Roedy Green, Jan 8, 2009
    #6
  7. TsanChung

    TsanChung Guest

    On Jan 7, 7:41 pm, Roedy Green <>
    wrote:
    > On Wed, 7 Jan 2009 07:00:33 -0800 (PST), TsanChung
    > <> wrote, quoted or indirectly quoted someone
    > who said :
    >
    > >My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    > >on a HP-UX B.11.23 U ia64 computer.
    > >Please help even though java 1.4 is old.

    >
    > seehttp://mindprod.com/jgloss/jni.html
    >
    > Check the library path in both cases.
    >
    > Your native code must be on the library path.
    > --

    The library path of java 1.4 & 1.6 are printed by the java program:
    System.out.println(System.getProperty("java.library.path"));

    /opt/java1.4/jre/lib/IA64N:/opt/java1.4/jre/lib/IA64N/server:/opt/
    java1.4/jre/../lib/IA64N:/opt/java1.4/jre/lib/ext:.:/usr/lib
    /opt/java6/jre/lib/IA64N:/opt/java6/jre/lib/IA64N/server:/opt/java6/
    jre/../lib/IA64N:/opt/java6/jre/lib/ext:.:/usr/lib

    My native code is copied to both /opt/java1.4/jre/lib/ext and /opt/
    java6/jre/lib/ext.
    I do not understand why java 1.4 do not find it but java 1.6 find it.
     
    TsanChung, Jan 23, 2009
    #7
  8. TsanChung

    TsanChung Guest

    On Jan 23, 3:24 pm, TsanChung <> wrote:
    > On Jan 7, 7:41 pm, Roedy Green <>
    > wrote:> On Wed, 7 Jan 2009 07:00:33 -0800 (PST), TsanChung
    > > <> wrote, quoted or indirectly quoted someone
    > > who said :

    >
    > > >My JNI program is working with java 1.5 & 1.6 but fail with java 1.4
    > > >on a HP-UX B.11.23 U ia64 computer.
    > > >Please help even though java 1.4 is old.

    >
    > > seehttp://mindprod.com/jgloss/jni.html

    >
    > > Check the library path in both cases.

    >
    > > Your native code must be on the library path.
    > > --

    >
    > The library path of java 1.4 & 1.6 are printed by the java program:
    > System.out.println(System.getProperty("java.library.path"));
    >
    > /opt/java1.4/jre/lib/IA64N:/opt/java1.4/jre/lib/IA64N/server:/opt/
    > java1.4/jre/../lib/IA64N:/opt/java1.4/jre/lib/ext:.:/usr/lib
    > /opt/java6/jre/lib/IA64N:/opt/java6/jre/lib/IA64N/server:/opt/java6/
    > jre/../lib/IA64N:/opt/java6/jre/lib/ext:.:/usr/lib
    >
    > My native code is copied to both /opt/java1.4/jre/lib/ext and /opt/
    > java6/jre/lib/ext.
    > I do not understand why java 1.4 do not find it but java 1.6 find it.


    Problem is solved!
    My native code cause load error with java 1.4 but not java 1.6.
    Changing the compile options solve this problem.
     
    TsanChung, Jan 23, 2009
    #8
  9. TsanChung

    anandmadhab

    Joined:
    Sep 30, 2011
    Messages:
    1
    For me its not working it is working some project but not running for few when I am using already built .so and .h file to create new project and using new shared library.
     
    anandmadhab, Sep 30, 2011
    #9
    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. Lorin Hochstein
    Replies:
    2
    Views:
    1,803
    Lorin Hochstein
    Mar 5, 2004
  2. Fahad
    Replies:
    1
    Views:
    547
    Roedy Green
    Jul 1, 2005
  3. Replies:
    1
    Views:
    2,386
    Roedy Green
    Sep 15, 2005
  4. MR
    Replies:
    1
    Views:
    612
    Roedy Green
    Oct 6, 2005
  5. TsanChung
    Replies:
    0
    Views:
    1,455
    TsanChung
    Sep 4, 2008
Loading...

Share This Page