CodeBunny
CodeBunny

Reputation: 2031

JPL/SWI Prolog not working

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?

Upvotes: 3

Views: 7667

Answers (4)

Fabio Ricci
Fabio Ricci

Reputation: 99

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

Upvotes: 0

izilotti
izilotti

Reputation: 4927

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

Upvotes: 0

Yves Martin
Yves Martin

Reputation: 10361

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.

Upvotes: 4

Csaba_H
Csaba_H

Reputation: 8245

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.

Upvotes: 1

Related Questions