2
votes

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?

4
"libjpl.dll" should be in "bin" directoryYves Martin
It is not. I think this is the problem. I'm going to try to find an older version of Prolog that has the correct libraries for JPL to work.CodeBunny
Sorry I am Unix-centric. For Windows, the file you need is "jpl.dll". For Unix, it is "libjpl.so". There is no "libjpl.dll" to look for on WindowsYves Martin

4 Answers

4
votes

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.

1
votes

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.

0
votes

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
0
votes

Could be rather

ln -s /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib /Library/Java/Extensions/libjpl.dylib

? (no .inilib was found under darwin folder)

In my case still error on mojave (SWI-Prolog (threaded, 64 bits, version 8.0.2)):

Jan 03, 2020 12:10:55 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [ACTIONS] in context with path [/SVIZ] threw exception [Servlet execution threw an exception] with root cause java.lang.UnsatisfiedLinkError: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib: dlopen(/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib, 1): Library not loaded: @rpath/libswipl.8.dylib Referenced from: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin/libjpl.dylib Reason: image not found