Please read the description of the "batch" function in the Jess
manual. First, you can't, nor need you, give batch a URL, only a path.
If batch is run from an applet, the applet's document base will be
appended; i.e., if the HTML file is http://www.../~myName/index.html,
then "(batch scriptlib.clp)" will look for
http://www.../~myName/scriptlib.clp automatically. If this isn't
found, Jess will use the ClassLoader.getResource method to try to find
the file; so if you applet it in a JAR file, (batch scriptlib.clp)
will find the file if it's at the top level of that JAR file.

Lastly, if you're writing your own applet, you need to tell Jess it's
running in an applet if you want (batch) to work this way. To do that,
you have to supply a reference to the applet as a constructor argument
to the Rete object you create; i.e., if the applet class itself call
new Rete(), it must pass 'this' as the constructor argument:
"new Rete(this);"




I think Rajaram Subramanian wrote:
> Hi,
> I have been trying for 3 days to fix things up, but I have a feeling i am
> doing it from the wrong angle altogether. The problem is this...
> 
> I have a Java applet to which I have to integrate some intelligence, which
> i do using JESS. When i run it as an application, from the main Java file 
> I create an instance of Rete and then batch the scriptlib.clp file as 
> 
> rete_.executeCommand("(batch jess/scriptlib.clp)");
> 
> This works fine, presumably because scriptlib.clp is found in this path. I
> also put my own file in this path and it works fine.
> 
> Now if i make my original Java application an applet, can I change this
> command to 
> 
> rete_.executeCommand("(batch http://www.../~myName/scriptlib.clp)"); 
> 
> without changing anything else? Do I have to change anything in class 
> Batch? When I run this, it still says 
> 
> context.getEngine().getApplet()=null
> 
> Hence it is not taking it as an applet. Also, I jar my files and put them
> on the server. Can i jar a .clp file too and access it with a relative
> path? Again, is there a problem with the symbol " ~ "?
> 
> Please do reply,
> 
> Regards,
> Raj.
> 
> 
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------

Reply via email to