JPL doesn't work on Processing

I can’t figure out why but JPL (library to use Prolog in Java) doesn’t work on Processing.
the link I used to download the library :
www.java2s.com/Code/Jar/j/Downloadjpljar.htm
and my code is :

import jpl.fli.*;
import jpl.*;
import java.util.Hashtable;

Atom x = new Atom("test.pl" ); 

Term arg[] = { x } ;

Query q1 = new Query( "consult", arg );
println(q1); 
println( "consult " + (q1.query() ));

and I get :
image
(I’ve also tried it on my 64 bits computer and the error is the same except replace 64 bits by 32 in the error message)
What can I do to make it work ? (Or is it a problem with Processing that would need me to do a bug report ? In which case, how do I do ?)
Thanks in advance for your responses

1 Like

Can you tell us where did you place this library after you downloaded it? When you download the file, do you have a jar file? If you do, then do the following:

In your sketch, hit ctrl+k if you are using Windows. Alternatively, in the PDE go to **File >> Sketchbook ** and this will open a folder where your pde file resides. In this folder, create a folder named code and then add the jar file (or multiple jar files in case you have more than one) in this folder. Run the sketch and see if it works. It is important to keep in mind that if it doesn’t work, it could be because this file is not compatible with Processing 3, in case it was built using Processing 2.

By the way, what does this library do?

Kf

1 Like

I’ve done what you advise me before creating the topic (and yes, it’s a jar file). I think part of the problem is that it isn’t a processing library. what the library is supposed to do is allowing us to run Prolog queries from Java, Prolog being another programming language.
I have used the FastMath library before which I thought wasn’t a processing library so I thought that this one would work to… Can it work ?

If the JPL library works in Java environment, then it should work in Processing as Processing if java after all.

What can Prolog do? More curious than anything else… The more details you provide, the better change you get more answers. I suggest you set a github repo with your code demonstrating your approach.

Kf

Let’s say I have the following Prolog code :

parent(bob, alice).
parent(bob, charlie).
sibling(X,Y) :- parent(Z,X), parent(Z,Y).

I than put in the following in the Prolog console

sibling(X,Y).

The console shows :

X = alice, Y = charlie ; 
X = charlie, Y = alice

(And Prolog also doesn’t have any stack overflow for instance)

It sounds like “a library relies on native code that is not available” might mean that JPL has some unmet dependencies – at the system level or in Java 8.

If you run JPL in Java on the same machine, does it work?

…not being a “Processing” library probably should not matter. Projects use lots of libraries that are from the larger Java ecosystem.

…possibly relevant:

https://github.com/processing/processing-video/issues/90

and previously:

https://github.com/processing/processing/issues/2472

one possible culprit was non-ascii file paths