I've got problem which wasn't solved anywhere else.
I've downloaded libjpl.dylib
and copied to
/usr/local/Cellar/swi-prolog/7.6.4/libexec/lib/swipl-7.6.4/lib/
The output of otool -L
of the libjpl.dylib
give me this output:
libjpl.dylib:
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/server/libjsig.dylib (compatibility version 1.0.0, current version 1.0.0) /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/server/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/Cellar/swi-prolog/7.6.4/libexec/lib/swipl-7.6.4/lib/x86_64-darwin17.3.0/libswipl.dylib (compatibility version 0.0.0, current version 7.7.19) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
and all paths are correct. The path to libjpl.dylib
is added to build path of project in Eclipse
and -Djava.library.path="/usr/local/Cellar/swi-prolog/7.6.4/libexec/lib/swipl-7.6.4/lib/"
is added to VM arguments in run configuration
. Anyway, when I want to compile it I've got an error:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
jpl.fli.Prolog.thread_self()I at jpl.fli.Prolog.thread_self(Native Method) at jpl.Query.open(Query.java:286) at jpl.Query.hasMoreSolutions(Query.java:256) at jpl.Query.oneSolution(Query.java:688) at jpl.Query.hasSolution(Query.java:759) at Pro.main(Pro.java:12)
What had I miss?
The code:
import jpl.*;
public class Pro {
public static void main(String[] args) {
////it gives the same error even if System.load doesn't exist
System.load("/usr/local/Cellar/swi-prolog/7.6.4/libexec/lib/swipl-7.6.4/lib/libjpl.dylib");
Term goal = new Compound( "teacher_of", new Term[]{new Atom("aristotle"),new Atom("alexander")});
Query q = new Query( goal );
q.hasSolution();
}
}