-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If Jess is running as an applet, then the URL loading is attempted; otherwise, if it's an application, then the file specified is opened using the FileReader() method. If either of those methods fail, the classpath is searched for the resource. If everything fails, a JessException is thrown.
- -Bryan
=====================================================================
The programmer, like the poet, works only slightly removed from pure
thought-stuff. He builds castles in the air, from air, creating
by exertion of the imagination.
- Frederick P. Brooks, Jr.
>-----Original Message-----
>From: Rajaram Subramanian [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 06, 2001 4:43 PM
>To: [EMAIL PROTECTED]
>Subject: RE: JESS: Path of .clp files
>
>
>Hi,
>From the source code, there seems to be provision made for URL's,
>right?! I tried this...
>
>String s1 = "http://www..../myFile.clp";
>rete.executeCommand("(batch s1)");
>
>Still no good!
>
>If i run it as an application, I give
>
>rete.executeCommand("(batch jess/scriptlib.clp)");
>
>in a file named, say, A.java. I compile it and store it in classes dir.
>Still it seems to work fine, eventhough there is no directory
>called jess
>relative to the A.class file.
>
>Is this a common problem or am I making a stupid blunder?
>
>Do reply,
>
>Regards,
>Raj.
>
>On Fri, 6 Apr 2001, Bryan Talbot wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Here's what my Jess 5.0 source code says ... if you're using
>a different
>> Jess version, you could check the source directly.
>>
>> - -Bryan
>>
>>
>>
>> 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().getSystemResourceAsStream(filename);
>> 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 (IOException ex)
>> {
>> throw new JessException("batch", "I/O Exception", ex);
>> }
>> finally
>> {
>> if (fis != null) try { fis.close(); } catch
>(IOException ioe) {}
>> }
>> return v;
>> }
>> }
>>
>>
>> =====================================================================
>> The programmer, like the poet, works only slightly removed from pure
>> thought-stuff. He builds castles in the air, from air, creating
>> by exertion of the imagination.
>>
>> - Frederick P. Brooks, Jr.
>>
>>
>> >-----Original Message-----
>> >From: Rajaram Subramanian [mailto:[EMAIL PROTECTED]]
>> >Sent: Friday, April 06, 2001 2:49 PM
>> >To: [EMAIL PROTECTED]
>> >Subject: JESS: Path of .clp files
>> >
>> >
>> >Hi,
>> >I have a strong feeling Ernest has already helped me with
>this, but I
>> >seem to have deleted that mail. I have a .clp file that i have
>> >created and
>> >i am batching it from a Java file. When i want to give
>> >
>> >rete.executeCommand("(batch myFile.clp)");
>> >
>> >what is the path that Jess will check for the presence of
>> >myFile.clp? Is
>> >this path relative to the directory where the corresponding
>Java class
>> >file is stored?
>> >
>> >Also, is it possible to have the .clp file on a web server
>and call it
>> >like this
>> >
>> >rete.executeCommand("(batch http://www.../~someone/myFile.clp)");
>> >
>> >Is there a problem with the symbol " ~ " ?
>> >
>> >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]
>>
>>---------------------------------------------------------------------
>> >
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: PGP Personal Privacy 6.5.2
>>
>> iQA/AwUBOs5GlkzuKKcxAa+OEQIZvwCfQJ24YnJeOEys32uHwZJTgSyXmIEAoNcl
>> SfG7UVdARqGYyqh7E1kZ7jfe
>> =YUK+
>> -----END PGP SIGNATURE-----
>>
>
>
>---------------------------------------------------------------------
>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]
>---------------------------------------------------------------------
>
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.2
iQA/AwUBOs5XsUzuKKcxAa+OEQLPDACgjHZfEB1hd45nMQNJZgQPTJmw2zQAoJJD
KSODfsYvqNJM0qamL+4efeLU
=cfqw
-----END PGP SIGNATURE-----
