织梦CMS - 轻松建站从此开始!

罗索

当前位置: 主页>杂项技术>JAVA>

There was an error trying to initialize the HPI library.

罗索客 发布于 2007-10-09 20:35 点击:次 
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
TAG:

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
zackusdorkus

///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////

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,

///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////

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.

(iwgh)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/200710/6822.html]
本文出处: 作者:iwgh
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容