Not sure what you're trying to do, but Jess is embedded as any other Java
object would be. Check the Jess website for the API.
Just create a rete object, connect a CLP file to it, add facts, and run.
Here's a not too great example, but it is an example of just embedding Jess
in a method, which of course will be ran with the method is called. Does
this help at all?

Example Code:

import jess.*;

public class SomeJavaObject{
     //whatever code exists in your object
    //perhaps analyze members within the object with Jess, whatever...
    private int x;
    private double y;
    private String s;

    //Constructor
    public SomeJavaObject{
       x = 1;
       y = 2.1231;
       s = "Socrates";
    }

    public static void exampleMethod(){
        try{
            //Create the engine
            Rete engine = new Rete();

            //Assert Facts - add whatever objects you want in the Rete
Engine for Jess to analyze
            engine.add(x);
            engine.add(y);
            engine.add(s);

            //Batch the CLP file
            engine.batch("rules.clp");

            //Run Rule Engine
            engine.run();

            //Either printout results from Jess to the console through
(printout t ...)
            //Or add Java Beans from that contain members which Jess might
change when a rule is triggered (remember to add a property change listener)
        }
        catch (JessException e){e.printStackTrace();
        }
    }
}


On Thu, Jan 7, 2010 at 5:11 AM, Adeyi <[email protected]> wrote:

>
> I want to embed Jess into Java code. The Java code is to be called from an
> eclipse-based IDE. Can I achieve my aim without the use of the main()
> method
> in Java? I need help please!!!
> --
> View this message in context:
> http://old.nabble.com/Is-it-Possible-to-Embed-Jess-Into-Java-Without-the-main%28%29-method--tp27059744p27059744.html
> Sent from the Jess mailing list archive at Nabble.com.
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
> in the BODY of a message to [email protected], NOT to the list
> (use your own address!) List problems? Notify [email protected].
> --------------------------------------------------------------------
>
>

Reply via email to