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

后端 未结 14 2263
逝去的感伤
逝去的感伤 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    <DIR>          .
    11/03/2016  09:07 PM    <DIR>          ..
    11/03/2016  09:07 PM    <DIR>          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
    
    0 讨论(0)
  • 2020-12-24 05:24

    Go to

    Project properties >> Run >> VM options

    and put this address:

    -Djava.library.path="C:\opencv\build\java\x64"
    
    0 讨论(0)
  • 2020-12-24 05:26

    I had an issue related to this and was reading

    "Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\opencv\build\java\x86\opencv_java2413.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform "
    

    and it took me an entire night to figure out.

    I solved my problem by copying the dll in C:\opencv\build\java\x64 to my system32 folder. I hope this will be of help to someone.

    0 讨论(0)
  • 2020-12-24 05:30

    Be sure you are setting PATH to Program Files (x86) not Program Files. That solved my problem.

    0 讨论(0)
  • 2020-12-24 05:31

    Short answer to first question: yes.

    Longer answer: maybe; it depends on whether the build process for SVMLight behaves itself on 64-bit windows.

    Final note: that call to System.loadLibrary is silly. Either call System.load with a full pathname or let it search java.library.path.

    0 讨论(0)
  • 2020-12-24 05:34

    Had same issue in win64bit and JVM 64bit

    Was solved by uploading dll to system32

    0 讨论(0)
提交回复
热议问题