I think that Kirstina wrote:

>> I am not sure why this happens, I only know that whenever I use
>> the defclass command (even from Jess prompt), I receive a
>> message like the one above:

Hi Kirstina,

I'm not sure if anyone ever got back to you, and I think that my original
reply got zapped because of my code attachment.

First, make sure that you place the path to the example classes and any
defclassed Java Beans on your classpath.  This is no different than what
you'd do for any other Java class.  Regular classes only need the path to
the class, but JAR files need the full path including the JAR file name.

>> Also, is it possible to create your own (userdefined) Java class

Of course!  This is one of the great strengths of Jess - leveraging all of
the regular Java API.  Again, make sure that you put your class on the Jess
classpath so that Jess can find it.  Unless you want to use the fully
qualified name for every class, you will want to import your classes into
your jess script.  For example, if you have a class Example.class in the
package com.util.kristina then you would add the following to your Jess
script:

(import com.util.kristina.*)
(bind ?objEx (new Example))

>> For the end - where can I find more on-line examples about
>> creating and manipulating Java objects from Jess including also
>> defclass and definstance commands.

The following online Jess references should prove useful:

Appendix A. Jess Functions Grouped by Usage
http://herzberg.ca.sandia.gov/jess/docs/61/function_index.html

2.7.4. Definstance facts
http://herzberg.ca.sandia.gov/jess/docs/61/language.html#definstance_facts

4.4.4. Transferring values between Jess and Java code
http://herzberg.ca.sandia.gov/jess/docs/61/library.html#xfer

You also will want to purchase a copy of "Jess In Action" by Dr.
Friedman-Hill.  Section 5.1 deals with creating Java objects and using them
via Jess scripting.  Section 6.5 discusses Shadow Facts (Facts that use Java
introspection to pull the fields of a Java Bean into Jess) and their
defclass and definstance commands.

If you can post some examples of what you'd like to try, there are many of
us here who will be happy to work out the code with you.

In the meantime, email me directly at:
<mailto:[EMAIL PROTECTED]'bean.zip'> and I'll
send you the ZIP that contains:

bean.bat -- a batch file that contains a Jess classpath example.  You can
translate this to a shell script.
bean.clp -- a Jess batch file that exercises the Example class below
Example.java -- a JavaBean that you can use both as a plain Java object and
as a Shadow Fact.

Try this out and let me know if this helps!

Cheers,

Jason Morris
Assistant Moderator - Jess Listserver
--------------------------------------

Morris Technical Solutions
[EMAIL PROTECTED]
www.morristechnicalsolutions.com
fax/phone: 503.692.1088




--------------------------------------------------------------------
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