我正忙着尝试使用interprolog
我有一些代码,尝试调用prolog命令,问题是我的prolog数据库的实际加载。这是代码:
myEngine = new NativeEngine();
myEngine.consultFromPackage("userlist.p", LoginHandler.class);
boolean x = myEngine.deterministicGoal("has_access(user,pass)");
当我运行程序prolog初始化正常时,它会尝试查找userlist.p,它位于同一个包中(第二行代码),然后抛出此错误:
Exception in thread "AWT-EventQueue-0" com.declarativa.interprolog.util.IPException: Problem consulting from package archive:C:\Users\Keval\AppData\Local\Temp\IP_6971701367857416872\userlist.p
at com.declarativa.interprolog.AbstractPrologEngine.consultFromPackage(AbstractPrologEngine.java)
at handlers.LoginHandler.actionPerformed(LoginHandler.java:25)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
我查看了consultFromPackage的代码:
public void consultFromPackage(String filename,Object requester){
String path = cleanPath(copyToTemp(filename,requester).getPath());
path = unescapedFilePath(path);
progressMessage("consultFromPackage:"+path);
if (!command("consult('"+path+"')"))
throw new IPException("Problem consulting from package archive:"+path);
}
但我似乎无法找到问题的根源。我知道这有点远了,但是目前还有任何帮助。
感谢
答案 0 :(得分:0)
我的猜测是路径出现了问题,并且没有在预期的位置找到user.p
。尝试从最小的命令行测试程序开始,以了解库如何在简单的原型中工作。