File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Java Products and Servers and the fly likes problem with jess!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "problem with jess!!!" Watch "problem with jess!!!" New topic

problem with jess!!!

assia assiatoune

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 ?
must I save my project in the same directory as the FILe.clp? or what?

waiting for your answer .thanks a lot!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

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


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]
Don't get me started about those stupid light bulbs.
subject: problem with jess!!!
It's not a secret anymore!