1
votes

I donwnloaded swi-prolog 7.2.2.

I copied the jpl.dll file (under swipl/bin) to system32.

I created a new project in Eclipse and I put the jpl.jar in the path (like any other jar files).

Then, when I try to launch this code:

package main_package;

import org.jpl7.Query;

public class Main {

    public static void main(String[] args) {

        String s = "consult('lib\rules.pl')";
        Query q = new Query(s); //the exception is thrown here
        System.out.println(q.hasSolution());

    }

}

I obtain:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Windows\System32\jpl.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

I read online that maybe I should change the java vm to his 32 bit version. I tried it by going to Window->Preferences->Java->Installed JREs and change the vm to the one under program x86 folder, but it did not help.

Any ideas?

2

2 Answers

1
votes

Install the 64-bit version of SWI-Prolog (http://www.swi-prolog.org/download/stable) and add the new directory to path.

0
votes

Although the directory name

C:\Windows\System32

leads us to believe that it contains the 32-bit versions of DLLs and programs, it does not. In fact, on 64-bit Windows systems it contains the 64-bit versions. The directory name was not changed due to compatibility reasons.

If a 32-bit program is started on a 64-bit Windows system, the operating system maps the directory

C:\Windows\SysWOW64

to be the System32 directory. So you have to place your 32-bit DLL into the SysWOW64 directory.

Summary:

  1. The directory System32 contains the 64-bit versions of the files.
  2. The directory SysWOW64 contains the 32-bit versions of the files.

Side note:

The "WOW" part in the directory name SysWOW64 means "Windows on Windows".

Link:

Wikipedia article about WOW64