It sounds like you're just asking a Java programming question here,
not a Jess question, really. The alternative to "static" isn't
"dynamic," but "member".
It looks like what's happening is that "rete" and "facts" are member
variables of your class, and you're trying to access them from a
static method (perhaps main()). That would give you the error message
you're seeing.
If you need them to be members and not static, then you have to
reference them from a non-static method, or through a reference to an
instance of you class; i.e.,
class Foo1 {
int bar;
static void baz1() { bar = 3; } // This will give the error message
// you're getting
class Foo2 {
int bar;
static void baz2() { new Foo2().bar = 3; } // This works
But (and I hope I am not insulting you here) if I need to tell you
this, then you probably don't understand my answer. In that case, you
really need to go out and get a book on Java programming. I might
humbly suggest you have a look at
http://www.amazon.com/exec/obidos/ASIN/0764535439
which I personally think is rather good, although not everyone
agrees.
I think Yanguo Jing wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Dear list
>
> I appologize if this question is too basic.
>
> When I use method listFacts in jess.Rete class, why both rete and facts in
> the following program should be static, but I really need them to be
> dynamic.
>
> Iterator facts=rete.listFacts();
>
> The error message is "non-static variable facts cannot be referenced from a
> static context". When I define both rete and facts to be static, no errors,
> but I really need them to be dynamic.
>
> Thanks!
>
> -Yanguo
>
>
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------