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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With