http://expert.csdn.net/Expert/topic/1638/1638392.xml?temp=.4825861

解决方案 »

  1.   

    在自己的程序中加一个静态块,类似于
    static{
        System.loadLibrary(dllName);
    }
      

  2.   

    不行呀,我的代码如下:
    public class test {
        public native void IsMemoHasp();
        static{
         System.load("hello");
        }
        
        /** Creates a new instance of test */
        public test() {
        }
        
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            new test().IsMemoHasp();
        }
        
    }可是不行,一运行就出下面的错:
    java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: hello
            at java.lang.Runtime.load0(Runtime.java:695)
            at java.lang.System.load(System.java:797)
            at test.<clinit>(test.java:14)
    Exception in thread "main" 我已经确定HOLLE。DLL文件和这个类文件在一起了,急!!!!
      

  3.   

    后来我设置了classpath环境变量后,再运行错误就变成:
    Exception in thread "main" java.lang.UnstaisfiedLinkError: IsMemoHasp
            at test.display<Native Method>
            at test.main<test.java:26> 我要如何做?
      

  4.   


    package untitled2;public class callhasp {
        public native int IsMemoHasp(long l0, long l1, String str);
        static{
         System.load("hello");
        }
        
        /** Creates a new instance of test */
        public callhasp () {
        }
        
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            new callhasp ().IsMemoHasp(1l,1l, "");
        }
        
    }
      

  5.   

    请问
    new callhasp ().IsMemoHasp(1l,1l, "");中的(1l,1l, "")是从何而来呀??ll与ll是什么意思呀?
      

  6.   

    我照楼上大哥说的改了,可是还是不行呀!!!!!
    错误还是:
    Exception in thread "main" java.lang.UnstaisfiedLinkError: IsMemoHasp
            at test.display<Native Method>
            at test.main<test.java:26> 
      

  7.   

    把System.load("hello");
    改成
    System.loadLibrary("hello");