tags:

views:

63

answers:

1

Hello everyone. I'm having a pretty rough time trying to make use of interprolog

I have some code, trying to call a prolog command and the problem is the actual loading of my prolog database. Here is the code:

    myEngine = new NativeEngine();
    myEngine.consultFromPackage("userlist.p", LoginHandler.class);
    boolean x = myEngine.deterministicGoal("has_access(user,pass)");

when i run the program prolog initializes fine, it tries to look for userlist.p which is in the same package(2nd line of code) and then it throws this error:

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)

I looked at the code for 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);
    }

but i can't seem to get to the root of the problem..i know this is all a bit far out, but any help is appreciated at this point.

thanks

A: 

My guess is that there is something going wrong with the paths and it isn't finding user.p in the location it expects. Try starting with a minimal command-line test program to get a feel for how the libraries work in a simple prototype.

rndmcnlly