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 开发者_StackOverflow中文版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?
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.
Looks like you have to set a special use-flag to support threading in swi-prolog.
Look here for more details:
http://comments.gmane.org/gmane.comp.ai.prolog.swi/5335
精彩评论