Calling DLL file using java getting error as java.lang.ExceptionInInitializerError

时间:2015-10-29 15:51:47

标签: java dll

I have a dll file which I am trying to call using my java program.

My java program and dll file both in the same folder C://JNI_project

My dll name is JNITest.dll

My java program is as follows:

public class JNITest {
   static{


      System.loadLibrary("JNITest");
   }

     public static void main(String[] args) {
     JNITest test=new JNITest();
      //test.greet();
   }
}

I executed the program in cmd as follows:

C:\JNI_project>javac JNITest.java

C:\JNI_project>java JNITest
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.IllegalArgumentException: key can't be empty
        at java.lang.System.checkKey(Unknown Source)
        at java.lang.System.getProperty(Unknown Source)
        at JNITest.<clinit>(JNITest.java:5)

I am getting errors on run time. Please guide me to solve this.

0 个答案:

没有答案