There was an error trying to initialize the HPI library.

Hai,

I am new to java programming. I am trying to invoke native application using JVM. I have a written a pilot code in C using JNI. I am getting the following error when I try to run the binary. I think that the problem is from the fact that 1.2.2 is installed in

/usr/bin directory (and is the default on the server). But I have set both

LD_LIBRARY_PATH, PATH and path

so that it points out 1.4.2. Here is the error

unable to create JVM

There was an error trying to initialize the HPI library.

Please check your installation, HotSpot does not work correctly

when installed in the JDK 1.2 Solaris Production Release, or

with any JDK 1.1.x release.

while building the binary I am using JDK1.4.1 header and lib files

These are my compilation arguments

g++ -g -I/opt/BES/jdk/jdk1.4.1/include/ -I/opt/BES/jdk/jdk1.4.1/include/solaris/ -L/opt/BES/jdk/jdk1.4.1/jre/lib/sparc/ -ljvm -ljava jniTest.C

If anybody has an idea why i am getting this problem and how to handle it?

Thanks

[1066 byte] By [ngacta] at [2007-10-1 18:16:35]
# 1

I had a similar problem. This is what I did to fix it:

Specify the jvm that you want to use specifically (the server or client)

Make sure that you specify the server or client path before you specify the sparc path (THE ORDER MATTERS!!):

-L/opt/BES/jdk/jdk1.4.1/jre/lib/sparc/client

-L/opt/BES/jdk/jdk1.4.1/jre/lib/sparc

I included the above lines when I compiled, but I also added the two paths to my LD_LIBRARY_PATH env variable before running. *** THE ORDER MATTERS!!

Good Luck,

Zack Thunemann

zackusdorkusa at 2007-7-11 13:03:25 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

This error may arise because the library file is not found or because there is a version mismatch. The latter may happen, for example, if you run 'java' from one Java distribution whereas your JAVA_HOME points to another Java distribution. (In the latter case, ensure JAVA_HOME is unset when calling 'java'.) Also, try passing this option to your java: -XX:+TraceHPI -- it may actually tell you what it is trying to do.

Vassa at 2007-7-11 13:03:25 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...