简体   繁体   中英

Restarting Prolog engine from Java using JPL

In one java application that uses JPL to interact with Prolog, I want to be able to restart the prolog engine with different settings. As an example, I would like to change from SWI to YAP (I configure which engine to use this with the method JPL.setNativeLibraryDir with the path of the right native library I need to use).

So after changing the JPL configuration, I was trying to halt the already running prolog engine in order to restart it again afterwards with JPL.init() .

First I took a look to JPL.halt() , but the documentation says it is deprecated and the comments in the source code of the method said that it is no-op.

Afterwards, I tried to just launch a query with 'halt', but although I see in the console "YAP execution halted" as expected, my java application is also halted (!).

Is there a way to restart the logic engine using JPL without killing my java application ?

why not using a batch file to run scripts. first you can have /Applications/swi -l your/swi/code and then use halt inside your prolog code so that it halts after execution. You can run your batch file inside java using runtime method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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