| Author |
problem with jess!!!
|
assia assiatoune
Greenhorn
Joined: Jul 11, 2004
Posts: 16
|
|
hello ! I have a problem with the "batch " command It does not work, it generates a jess exception:"can't open file" NB: i am workin with Jbuilder. I am using the Rete classe and using ; Rete rete.exectutecommand("(batch ...../draw.clp)"); and the file draw.clp would not be loaded ? why? must I save my project in the same directory as the FILe.clp? or what? waiting for your answer .thanks a lot! luyza
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
You haven't shown the actual line of code you're using, so I can't say specifically what's going on, but the argument to batch can be either a path relative to the current directory, or an absolute path. If you're using a relative path, then it's relative to the current directory, and you must know what the current directory is, of course -- and JBuilder is notorious for confusing new users in this regard. You might try compining and running a program that contained a line like System.out.println(new java.io.File(".").getAbsolutePath()); as this would show you exactly what the current directory is when you run a program. If on the other hand you're using an absolute path, and if, as I imagine you must be, you're using Windows, then you've probably got a ":" in your path, and perhaps some "\" backslash characters (this may be also be the case if you're using a relative path.) If your path includes any of these special characters, then be sure to heed what it says in the documentation for the 'batch' function (manual section 8.20):
Note: the argument must follow Jess' rules for valid atoms or strings. On UNIX systems, this presents no particular problems, but Win32 filenames may need special treatment. In particular: pathnames should use either '\\' (double backslash) or '/' (forward slash) instead of '\' (single backslash) as directory separators; and pathnames which include a colon (':') or a space character (' ') must be enclosed in double quotes.
Finally, note that the above quote is talking about code in the Jess language; if you need to represent Jess language code in a Java string -- as you're doing in the argument to executeCommand above -- then you may need futher escaping of special characters; i.e., your line of code may end up looking like engine.executeCommand("(batch \"C:/path/to/file.clp\")"); Note how the double quote surrounding the path are escaped so they can be included in a Java string.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: problem with jess!!!
|
|
|