I am having trouble getting the packages straight in creating a new
User function or User package. I have many new Userfunction, e. g.
package jess;
import jess.*;
import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import java.io.*;
import java.lang.String;
//import jess.J6Filter;
public class J6 implements Userfunction
{
public String getName () {return "LoadXMLDirectory";}
// takes as name URL and creates a fact for that XML
public Value call (ValueVector vv, Context context) throws JessException
{
PrintWriter f2 = null;
String xmlDirectoryName = "";
....
OR
package jess;
import java.io.*;
public class LoadXMLFunctions implements Userpackage {
PrintWriter f2;
public void add(Rete engine)
{
try {
f2 = new PrintWriter(new FileWriter("c:\\Load.out"));
f2.println("lXMLF one"); f2.flush();
}
I put these in jess60a5/jess on my UNIX machine.
I compile without error by going to the jess60a5 directory and typing
javac jess.LoadXMLFunctions.java
Before, my environment variables were set as follows:
CLASSPATH=/usr/java1.3/lib/dt.jar:/usr/java1.3/lib/tools.jar:/home/mflll/XML4J-3_1_1/xerces.jar:/home/mflll/XML4J-3_1_1/xml4j.jar:/home/mflll/XML4J-3_1_1/xercesSamples.jar:/home/mflll/Jess60a5:/home/mflll/Jess60a5/jess
JAVAHOME=/usr/java1.3
Unfortunately, when I try to use my load package, it does not work:
Script started on Thu Apr 26 13:37:51 2001
uxb1% java jess.Main
Jess, the Java Expert System Shell
Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation
Jess Version 6.0a5 3/12/2001
Jess> (load-package LoadXMLFunctions)
Exception in thread "main" java.lang.NoClassDefFoundError: LoadXMLFunctions
(wrong name: jess/LoadXMLFunctions)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at jess.LoadPkg.call(MiscFunctions.java:285)
at jess.FunctionHolder.call(FunctionHolder.java:37)
at jess.Funcall.execute(Funcall.java:247)
at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1520)
at jess.Jesp.parseSexp(Jesp.java:180)
at jess.Jesp.parse(Jesp.java:61)
at jess.Main.execute(Main.java:136)
at jess.Main.main(Main.java:23)
uxb1% ^D
script done on Thu Apr 26 13:38:07 2001
I have been working for a year with MS-DOS and jess60a2 and jess60a4.
There, I did not have these problems with my Userpackages
and Userfunctions under MS-DOS
And I did NOT have the
package jess;
line at the top of my .java files for my new Userfunction and Userpackage
while they appear to be needed in Solaris.
In DOS< I compiled by typing
javac -d . jess/LoadXMLFunctions.java
and everything worked.
Thus, when I ran with Solaris UNIX, I did NOT include any line like:
package jess;
in my functions.
Unfortunately, I get the error message
Script started on Thu Apr 26 13:42:05 2001
uxb1% javac -d . jess/LoadXMLFunctions.java
jess/LoadXMLFunctions.java:3: cannot access Userpackage
bad class file: /home/mflll/Jess60a5/jess/Userpackage.class
class file contains wrong class: jess.Userpackage
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class LoadXMLFunctions implements Userpackage {
^
1 error
uxb1% exit
script done on Thu Apr 26 13:42:22 2001
Yet this works fine under MS-DOS.
I observed that the Makefile for jess did not include have the -d .
flag for Solaris yet that is needed for compiling Jess under DOS.
Thanks for any help in understanding the Jess package structure and
moving my working code to UNIX.
Dr. Laurence Leff Western Illinois University, Macomb IL 61455 ||(309) 298-1315
Stipes 447 Assoc. Prof. of Computer Sci. ||Pager: 309-367-0787 800-512 0787
alt.binaries.pictures.fine-art hierarchy || FAX: 309-298-2302
---------------------------------------------------------------------
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]
---------------------------------------------------------------------