JPL/SWI Prolog not working

2019-07-18 06:29发布

问题:

I'm trying to use the SWI-Prolog JPL library, but I'm having problems.

I'm trying to let my Eclipse project access JPL, but when I try to start the program, I get the following error:

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no jpl in java.library.path

I copied the jpl.jar into my project directory, and I set it on the build path. Additionally, I pass the following VM arguments:

-Djava.library.path="C:\Program Files\Prolog\bin"

(That's the directory where Prolog was installed).

What am I doing wrong?


EDIT: I don't seem to have the libpl.dll anywhere on my computer. Could this be causing my problem?

回答1:

The jvm.dll of your running JDK/JRE must be available in your system PATH so that jpl.dll from java.library.path loads properly.

You have to take care to 32 bits / 64 bits consistency between your JPL installation and your running JVM - so do not try any mix.

Here is information from an old installation doc.

For such installation support, you should use the JPL mailing list.



回答2:

You should set the java.library.path to the folder where the jpl.dll file is located. As far as I know it is the Prolog\bin folder.



回答3:

A system-wide solution in a Mac environment (SWI-Prolog version 7.1.4 for x86_64-darwin13.1.0) would be to create the following symlink:

ln -s /usr/local/Cellar/swi-prolog/7.1.4/libexec/lib/swipl-7.1.4/lib/x86_64-darwin13.1.0/libjpl.jnilib /Library/Java/Extensions/libjpl.jnilib