Can't load IA 32-bit .dll on a AMD 64-bit platform

后端 未结 14 2262
逝去的感伤
逝去的感伤 2020-12-24 05:20

I am trying to use SVMLight from Java, using the JNI wrapper on this page:

  static {
    System.loadLibrary(\"lib/JNI_SVM-light-6.01/lib/svmlight\");
  }
         


        
14条回答
  •  攒了一身酷
    2020-12-24 05:23

    Here is an answer for those who compile from the command line/Command Prompt. It doesn't require changing your Path environment variable; it simply lets you use the 32-bit JVM for the program with the 32-bit DLL.

    For the compilation, it shouldn't matter which javac gets used - 32-bit or 64-bit.

    >javac MyProgramWith32BitNativeLib.java
    

    For the actual execution of the program, it is important to specify the path to the 32-bit version of java.exe

    I'll post a code example for Windows, since that seems to be the OS used by the OP.

    Windows

    Most likely, the code will be something like:

    >"C:\Program Files (x86)\Java\jre#.#.#_###\bin\java.exe" MyProgramWith32BitNativeLib 
    

    The difference will be in the numbers after jre. To find which numbers you should use, enter:

    >dir "C:\Program Files (x86)\Java\"
    

    On my machine, the process is as follows

    C:\Users\me\MyProject>dir "C:\Program Files (x86)\Java"
     Volume in drive C is Windows
     Volume Serial Number is 0000-9999
    
     Directory of C:\Program Files (x86)\Java
    
    11/03/2016  09:07 PM              .
    11/03/2016  09:07 PM              ..
    11/03/2016  09:07 PM              jre1.8.0_111
                   0 File(s)              0 bytes
                   3 Dir(s)  107,641,901,056 bytes free
    
    C:\Users\me\MyProject>
    

    So I know that my numbers are 1.8.0_111, and my command is

    C:\Users\me\MyProject>"C:\Program Files (x86)\Java\jre1.8.0_111\bin\java.exe" MyProgramWith32BitNativeLib
    

提交回复
热议问题