Search code examples
javajess

How do i make shadow facts?


i copy the example in jess manual for understand the shadow facts but doesn´t work. i want to make myself code but without this i don´t know how to do it.

i created de same class on java and the same code on jess and didn´t run, i don´t know if i missing something

import java.io.Serializable;

 public class Account implements Serializable {
   private float balance;
   public float getBalance() { return balance; }
   public void setBalance(float balance) {
      this.balance = balance;
   }
    // Other, more interesting methods
 }
     //this is what i copy exactly of java´s example

       //Now the jess's example:

   (deftemplate Account
        (declare (from-class Account)
      (include-variables TRUE))
      )
    (reset)       

      (bind ?a (new Account))
       (add ?a)
       (facts)

i ran this with command prompt like i have done with another examples and didn´t work. please helpe on this i am new but i want to learn. :d


Solution

  • If the error message is "Class not found", then the issue is simply that Java can't find your Account class. It needs to be on the Java classpath for Java to be able to load it. The default Jess startup scripts include "." (the current directory) and the CLASSPATH environment variable on the Java classpath. If you're not using those scripts, or if your class is located somewhere else, then you have to make appropriate adjustments. The specifics are dependent on your environment, of course.