JAVA调用C写的类库,当JAVA类没有package的时候调用没有问题,加上package后报错:
Exception in thread "main" java.lang.UnsatisfiedLinkError: ComputeCID
at com.xunlei.portal.util.InterComm.ComputeCID(Native Method)
at com.xunlei.portal.util.InterComm.main(InterComm.java:22)代码如下:
package com.xunlei.portal.util;public class InterComm { private static native String ComputeCID(String[] str); static
{
System.load("/usr/yuhongbo/libComputeCID.so");
}
public static void main(String[] args){
String[] str = new String[] {"dft","sasd"};
System.out.println(InterComm.ComputeCID(str));
}
}如果去掉package com.xunlei.portal.util,那么调用正常。
那位兄弟姐妹知道是怎么回事情呀?
Exception in thread "main" java.lang.UnsatisfiedLinkError: ComputeCID
at com.xunlei.portal.util.InterComm.ComputeCID(Native Method)
at com.xunlei.portal.util.InterComm.main(InterComm.java:22)代码如下:
package com.xunlei.portal.util;public class InterComm { private static native String ComputeCID(String[] str); static
{
System.load("/usr/yuhongbo/libComputeCID.so");
}
public static void main(String[] args){
String[] str = new String[] {"dft","sasd"};
System.out.println(InterComm.ComputeCID(str));
}
}如果去掉package com.xunlei.portal.util,那么调用正常。
那位兄弟姐妹知道是怎么回事情呀?
解决方案 »
- 类中对象的初始化
- 急!!!急!!!哪里有汤阳光讲的itcastbbs资料????
- 在演示hibernate练习的时候,我在生成ORM映射的时候,为什么会出现两个POJO类呢?
- 请教显示HTML文件时为什么有些图片出不来?
- 在程序中怎样重新加载类啊?
- eclipse2.11 VS jbuilder6.0 比比,看谁更加慢?
- 学了几年JAVA,可是新建对象的问题还是搞不清,帮帮忙啊!
- 求助~~~在线等待
- 如何将jar文件打成安装包,安装后可以生成快捷方式,象windows程序一样直接运行而不用java classfile这样的命令。
- 我公司想上OA软件,谁能给我点好建议吗?
- 一个关于sql分段运行的问题.
- java中文乱码
javah -classpath . com.xunlei.portal.util.InterComm
来创建.h头文件