• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

problem with jess!!!

Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
author and iconoclast
Posts: 24207
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic