Problem configuring JPL on MacBook using Intellij

194 views
Skip to first unread message

Roberto Paul Malutan

unread,
Feb 3, 2017, 7:09:34 PM2/3/17
to SWI-Prolog
Hi,
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)
 
Anyone knows what the solution to this might be?

Thank you.

Jan Wielemaker

unread,
Feb 4, 2017, 3:34:45 AM2/4/17
to Roberto Paul Malutan, SWI-Prolog
On 02/04/2017 01:09 AM, Roberto Paul Malutan wrote:
> Hi,
> 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:

Problem is that libjpl.dylib finds libswipl.dylib relative to the
*executable* in
the application bundle. I'm not that deep into MacOS to know whether or
not there
is an (elegant) solution to this. The simplest is probably to use the
Macports or
Homebrew version that is not relocatable and shouldn't suffer from this
issue.

Cheers --- Jan


> /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)
>
> Anyone knows what the solution to this might be?
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages