1

I am trying to understand how to use JPL. For this purpose I copied one of it's tests from the doc section (swipl\doc\packages\examples\jpl\java\Time) to eclipse and tried to run it.

If I double click the batch file, all runs well. If I run the Time class using eclipse I get

Exception in thread "main" jpl.PrologException: PrologException: error(existence_error(source_sink, 'time.pl'), _0)

I created a simple java project. Copied Time.java and time.pl to the root. Also I created the needed Path variables and connected the jpl.jar to the project.

JPL.init() works. I fail on the if statement of this part:

static void test_0() {

        Query query = new Query("consult('time.pl')");

        if (!query.hasSolution()) {
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Ido Barash
  • 4,856
  • 11
  • 41
  • 78

1 Answers1

1

The path to the prolog file should have the suffix of src/

Query query = new Query("consult('src/time.pl')");
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Ido Barash
  • 4,856
  • 11
  • 41
  • 78