Java Pets Callback Sample

This sample illustrates building extended predicates in Java.

Building the Sample

  1. Make sure amzijni.dll (Windows) or libamzijni.so (Unix) is on your path (it is in amzi/bin).
  2. Compile and link pets.pro into pets.xpl
  3. Use javac to compile the main program, Pets.java and the extended predicate, AmziPreds.java
If you are going to use extended predicates in a package, then modify your call to AddPred as follows:
ls.AddPred("prompt", 2, "amzi/test/AmziPreds", "prompt", this);

Note, you must use forward slashes (not periods (.)) to delineate the package name.

Running the Sample

  1. Type java Pets to run the program--the prompts are issued by the extended predicate.

Copyright ©1987-2004 Amzi! inc. All Rights Reserved. Amzi! is a registered trademark and Logic Server and e-Prolog are trademarks of Amzi! inc.