I am Roberto and I am trying to use JPL on my MacBook (MacOS Sierra). I have installed SWI-Prolog, I have added jpl.jar as a dependency and I have set the path -Djava.library.path=/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0, the directory where libswipl.dylib and libjpl.dyblib are present.
After doing all that I am getting always this error when trying to run any program (I am using Intellij as my IDE):
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib: dlopen(/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib, 1): Library not loaded: @executable_path/../swipl/lib/x86_64-darwin15.6.0/libswipl.dylib
Referenced from: /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0/libjpl.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.jpl7.JPL.loadNativeLibrary(JPL.java:112)
at org.jpl7.fli.Prolog.<clinit>(Prolog.java:70)
at org.jpl7.Query.open(Query.java:300)
at org.jpl7.Util.textToTerm(Util.java:127)
at org.jpl7.Query.<init>(Query.java:185)
at MainJPL.main(MainJPL.java:7)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Thank you.