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

T

TsanChung

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)
 
J

Joshua Cranmer

TsanChung 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.

$ /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.
 
T

TsanChung

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.

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
 
T

TsanChung

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?
 
T

TsanChung

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
 
R

Roedy Green

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
 
T

TsanChung

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.
 
T

TsanChung

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.
 
Joined
Sep 30, 2011
Messages
1
Reaction score
0
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top