Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jar file doesn't load prolog

Tags:

java

prolog

In Netbeans it runs well but when i try to run it from jar file it doesn't load Prolog and stops there. The code i am using is:

Term consult_arg[] = {
    new Atom("C://Users//dmpasd//Documents//NetBeansProjects//Anemia//src//anemia//new.pl")
};
Query consult_query
        = new Query(
                "consult",
                consult_arg);

boolean consulted = consult_query.hasSolution();

if (!consulted) {
    System.err.println("Consult failed");
    System.exit(1);

}

My next step was to change the newAtom to

new Atom(Diagnosis.class.getResource("new.pl").getPath())

but still nothing.

like image 325
Debbie Mp Avatar asked Apr 16 '26 11:04

Debbie Mp


1 Answers

Assume you have this directory layout:

YourProject/
YourProject/gui.jar
YourProject/lib/jpl.dll
YourProject/lib/jpl.jar
YourProject/lib/jpl.pl
YourProject/lib/libpl.dll

Then you could create

YourProject/startme.cmd 

With the following contents:

REM @ECHO OFF
cd %CD%
java -Djava.library.path=.\lib\ -classpath gui.jar;lib\jpl.jar -jar gui.jar
pause

Now start that and see what happens.

like image 129
Jan Avatar answered Apr 19 '26 01:04

Jan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!