Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception thrown when trying to use JPL and YAP Prolog in OS X

Tags:

java

prolog

jpl

yap

I am trying to use JPL for the interaction of Java programs and YAP Prolog.

In my java file, this line is throwing an exception:

Query query = new Query("consult", new Term[] { new Atom("test.pl") });

The exception is shown below:

Exception in thread "main" jpl.JPLException: this Query's engine is not that which is attached to this thread
at jpl.Query.close(Query.java:511)
at jpl.Util.textToTerm(Util.java:165)
at jpl.Query.Query1(Query.java:183)
at jpl.Query.<init>(Query.java:176)
at Test.main(Test.java:12)

Although I did not find someone reporting the same problem in YAP, some people were having this problem with SWI, and they were advised to verify that SWI was compiled with multi-threading support. Just in case I compiled YAP with support for multithreading, but it did not help.

This problem is happening only in OS X, I tried in Ubuntu and everything works fine there.

Does someone know a workaround for this problem in OS X?

like image 638
Sergio Avatar asked Jul 14 '11 13:07

Sergio


1 Answers

After updating Yap to 6.2.2 JPL is working correctly. Unfortunately I cannot be completely sure that the problem was indeed linked to the previous Yap version I was using (6.2.0) or it was related to something else.

like image 71
Sergio Avatar answered Sep 28 '22 05:09

Sergio