简体   繁体   English

如何通过JPL在Java应用程序内部运行的Prolog代码上使用GUI调试器?

[英]How can I use a GUI debugger on the Prolog code that runs inside a Java app through JPL?

I'm developing a Java+Prolog application through the JPL bridge. 我正在通过JPL桥开发Java + Prolog应用程序。 The main application is in Java and it calls the Prolog code using Query.oneSolution("doPrologStuff(here)") 主要应用程序是Java,它使用Query.oneSolution("doPrologStuff(here)")调用Prolog代码。

I tried running the GUI debugger/tracer using Query.hasSolution("gtrace") but it throws an exception: 我尝试使用Query.hasSolution("gtrace")运行GUI调试器/跟踪器,但抛出异常:

Exception in thread "main" jpl.PrologException: PrologException: error(existence_error(procedure, /(gtrace, 0)), context(:(system, /('$c_call_prolog', 0)), _0))
    at jpl.Query.get1(Query.java:336)
    ...

(Same goes for "guitracer") (“ guitracer”也一样)

Calling gtrace. 调用gtrace. works well when I run the Prolog code in swipl directly. 当我直接在swipl运行Prolog代码时,效果swipl

When I try Query.hasSolution("trace") it lets me debug the code using the text console, but that's not what I'm looking for. 当我尝试Query.hasSolution("trace")它使我可以使用文本控制台调试代码,但这不是我想要的。 Any ideas how to enable the GUI debugger? 有什么想法如何启用GUI调试器吗?

I'm using Eclipse on Ubuntu to develop, but I can try other tools if that helps :) 我在Ubuntu上使用Eclipse进行开发,但是如果有帮助,我可以尝试其他工具:)

You need to attach Prolog's graphical environment (xpce). 您需要附加Prolog的图形环境(xpce)。 You can do that by loading the file swi('swipl.rc'). 您可以通过加载文件swi('swipl.rc')来实现。 The next question is whether or not event dispatching happens. 下一个问题是事件分发是否发生。 That depends on the setup. 这取决于设置。 If you use the latest 5.11.18/5.10.4 versions, you can set the Prolog flag xpce_threaded to true, which causes SWI-Prolog to run the development tools in their own thread (currently only works on Unix/Linux systems). 如果使用最新的5.11.18 / 5.10.4版本,则可以将Prolog标志xpce_threaded设置为true,这会使SWI-Prolog在其自己的线程中运行开发工具(当前仅在Unix / Linux系统上有效)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM