Java Native Interface 32 bit dll on 64 bit system

前端 未结 6 1664
春和景丽
春和景丽 2020-12-01 10:18
E:\\Code\\Java\\JNITest>java test
Exception in thread \"main\" java.lang.UnsatisfiedLinkError: E:\\Code\\Java\\JNITest\\test.dll: Can\'t load IA 32-bit .dll on a          


        
6条回答
  •  醉酒成梦
    2020-12-01 11:05

    You'll have to install a 32bit JVM and you will be able to run your code.

    If you are going to distribute your application, you will want to build both 32bit and 64bit versions of your DLL. Then use the following technique to have the proper DLL loaded regardless of your customers arch. Append either a 32 or a 64 (MyJniDLL32.dll & MyJniDLL64.dll) to your generated output file.

        String archDataModel = System.getProperty("sun.arch.data.model");
        System.loadLibrary(libraryName+archDataModel);
    

提交回复
热议问题