This was -supposed- to work, but I'm not sure I ever tested it (you
all know I'm not much in favor of applets.) It looks like this support
is slightly broken. With a few modifications to jess.Batch, though, it
works as intended. Here's a fixed version of that class (in
Funcall.java)

class Batch implements Userfunction, Serializable
{
  public String getName() { return "batch";}
  
  public Value call(ValueVector vv, Context context) throws JessException
  {
    String filename = vv.get(1).stringValue(context);
    Value v = Funcall.FALSE;
    Reader fis = null;
    try
      {
        try
          {
            if (context.getEngine().getApplet() == null)
              fis = new FileReader(filename);
            else
              {
                URL url
                  = new URL(context.getEngine().getApplet().getDocumentBase(),
                            vv.get(1).stringValue(context));          
                fis = new InputStreamReader(url.openStream()); 
              }         
          }
        catch (Exception e)
          {            
            // Try to find a resource file, too.            
            InputStream is = 
getClass().getClassLoader().getResource(filename).openStream();
            if (is == null)
              throw new JessException("batch", "Cannot open file", e);
            fis = new InputStreamReader(is);
          }
        Jesp j = new Jesp(fis, context.getEngine());
        do
          {
            v = j.parse(false);
          }
        while (fis.ready());
      }
    catch (Exception ex)
      {
        throw new JessException("batch", "I/O Exception", ex);
      }    
    finally
      {
        if (fis != null) try { fis.close(); } catch (IOException ioe) {}
      }
    return v;
  }
}
 



I think Javier Maria Torres Ramon wrote:
> Hi,
> 
> I wanted to know if JESS gets .clp from a jar file in case it is started from
> an applet, and Rete (Applet applet) is called as a constructor.
> 
> Thanks and greetings,
> 
> Javier Torres
> ---------------------------------------------------------------------
> 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