Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

7 views
Skip to first unread message

TsanChung

unread,
Jan 7, 2009, 10:00:33 AM1/7/09
to
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)

Joshua Cranmer

unread,
Jan 7, 2009, 10:19:39 AM1/7/09
to
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

TsanChung

unread,
Jan 7, 2009, 10:53:09 AM1/7/09
to

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

unread,
Jan 7, 2009, 11:04:11 AM1/7/09
to

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?

bugbear

unread,
Jan 7, 2009, 11:12:31 AM1/7/09
to
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

TsanChung

unread,
Jan 7, 2009, 11:38:11 AM1/7/09
to

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

Roedy Green

unread,
Jan 7, 2009, 7:41:51 PM1/7/09
to
On Wed, 7 Jan 2009 07:00:33 -0800 (PST), TsanChung
<tsanchu...@gmail.com> 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

TsanChung

unread,
Jan 23, 2009, 3:24:23 PM1/23/09
to
On Jan 7, 7:41 pm, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:

> On Wed, 7 Jan 2009 07:00:33 -0800 (PST), TsanChung
> <tsanchung.w...@gmail.com> 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

unread,
Jan 23, 2009, 4:42:40 PM1/23/09
to

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.

0 new messages