Hmmm, OK. Well, I did a bit of fooling around and I believe I know
what's happening. It's some sort of "feature" of recent Java class
loaders, apparently, with regards to runnable jar files. The short
answer: make sure jess.jar is on the CLASSPATH, then use "java
jess.Main" to start Jess. If you use "java -jar jess.jar," the Java
class loader apparently won't find other classes along the
classpath. Gotta love that!
Perhaps the idea is that a runnable jar file is supposed to be a
self-contained entity, and finding classes outside of it is a
potential security problem.
In any case, I will amend the Jess manual, and in the next release,
jess.jar won't be a runnable file.
I think Sven Schwarz wrote:
> Yipp! No problem -- as usual...
> I compiled and ran the code below and got "-> fubar" as result.
> As long as the JADA libs are in CLASSPATH or -cp, everthing compiles
> and runs fine.
>
> Besides: "(new TestClass)" doesn't work in Jess either :-(
>
>
> public class TestClass {
> public void foo() {
> jade.core.AID aid = new jade.core.AID();
> aid.setName("fubar");
> System.out.println("-> "+aid.toString());
> }
>
> public static void main (String[] args) {
> new TestClass().foo();
> }
> }
>
>
> Thanks for your time!
>
> Sven
>
>
> friedman_hill ernest j wrote:
> >
> > Jess just uses java.lang.Class.forName() to find the Class object for
> > the (new) function, so if you can compile and run a Java program which
> > uses Java and works with this CLASSPATH, then Jess will work too. So,
> > can you compile and run this?
> >
> > public class TestClass {
> > public void foo() {
> > new jade.core.AID();
> > }
> > }
> >
> > I think Sven Schwarz wrote:
> > > Hello!
> > >
> > > I'm using Jess 6.0a6 and have problems accessing Java objects from
> > > within Jess. To be more precise: Creating JDK objects like e.g.
> > > java.util.Vector is no problem (see code snippet below), but whenever
> > > I try to create a new ACLMessage or something not includes in the JDK,
> > > Jess answers me with a "class unknown" exception.
> > >
> > > I've set the CLASSPATH env. variable and startet the Java virtual machine
> > > for Jess with the respective -cp / -classpath parameter, but Jess simply
> > > responds with a class-unknown-exception.
> > >
> > > The last attempt was to use some (import ...) statements, but that was of
> > > no use either. What are these statements good for, by the way?
> > >
> >
> > Same as in Java; saves you some typing, that's all.
> >
> > >
> > > Hopefully one of you can help me. Have a nice day!
> > >
> > > Sven
> > >
> > >
> > > --- O.K., here comes the protocol: ---------------------------------------------
> > >
> > > REM The following line is just an echo of the CLASSPATH env. variable
> > > CLASSPATH=.;C:\java\SiLRI1.2\IE;C:\java\SiLRI1.2\jars\gnu-regexp-1.0.8.jar;C:\ja
> > > va\SiLRI1.2\jars\rdf-api-1999-12-18.jar;C:\java\JavaCC\classes;C:\java\jade\lib\
> > > Base64.jar;C:\java\jade\lib\iiop.jar;C:\java\jade\lib\jade.jar;C:\java\jade\lib\
> > > jadeTools.jar;C:\java\jade-010517\jade\src;C:\java\Jess\jess.jar;C:\java\wwf\cla
> > > sses;C:\java\wwf-steffen\classes
> > >
> > > Jess, the Java Expert System Shell
> > > Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation
> > > Jess Version 6.0a6 5/3/2001
> > >
> > > This copy of Jess will expire in 3 day(s).
> > >
> > >
> > > Jess> (bind ?v (new java.util.Vector))
> > >
> > > <External-Address:java.util.Vector>
> > >
> > >
> > > Jess> (bind ?m (new jade.core.AID))
> > >
> > > Jess reported an error in routine new
> > > while executing (new jade.core.AID)
> > > while executing (bind ?m (new jade.core.AID)).
> > > Message: Class not found.
> > > Program text: ( bind ?m ( new jade.core.AID ) ) at line 2.
> > > Nested exception is:
> > > jade.core.AID
> > > java.lang.ClassNotFoundException: jade.core.AID
> > > at java.net.URLClassLoader$1.run(Unknown Source)
> > > at java.security.AccessController.doPrivileged(Native Method)
> > > at java.net.URLClassLoader.findClass(Unknown Source)
> > > at java.lang.ClassLoader.loadClass(Unknown Source)
> > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> > > at java.lang.ClassLoader.loadClass(Unknown Source)
> > > at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> > > at java.lang.Class.forName0(Native Method)
> > > at java.lang.Class.forName(Unknown Source)
> > > at jess.Rete.if(Unknown Source)
> > > at jess.cp.call(Unknown Source)
> > > at jess.d2.a(Unknown Source)
> > > at jess.Funcall.execute(Unknown Source)
> > > at jess.FuncallValue.resolveValue(Unknown Source)
> > > at jess.ck.call(Unknown Source)
> > > at jess.d2.a(Unknown Source)
> > > at jess.Funcall.execute(Unknown Source)
> > > at jess.Jesp.a(Unknown Source)
> > > at jess.Jesp.char(Unknown Source)
> > > at jess.Jesp.parse(Unknown Source)
> > > at jess.Main.execute(Unknown Source)
> > > at jess.Main.main(Unknown Source)
> > >
> > >
> > > Jess> (bind ?msg (new jade.lang.acl.ACLMessage))
> > >
> > > Jess reported an error in routine new
> > > while executing (new jade.lang.acl.ACLMessage)
> > > while executing (bind ?msg (new jade.lang.acl.ACLMessage)).
> > > Message: Class not found.
> > > Program text: ( bind ?msg ( new jade.lang.acl.ACLMessage ) ) at line 3.
> > > Nested exception is:
> > > jade.lang.acl.ACLMessage
> > > java.lang.ClassNotFoundException: jade.lang.acl.ACLMessage
> > > at java.net.URLClassLoader$1.run(Unknown Source)
> > > at java.security.AccessController.doPrivileged(Native Method)
> > > at java.net.URLClassLoader.findClass(Unknown Source)
> > > at java.lang.ClassLoader.loadClass(Unknown Source)
> > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> > > at java.lang.ClassLoader.loadClass(Unknown Source)
> > > at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> > > at java.lang.Class.forName0(Native Method)
> > > at java.lang.Class.forName(Unknown Source)
> > > at jess.Rete.if(Unknown Source)
> > > at jess.cp.call(Unknown Source)
> > > at jess.d2.a(Unknown Source)
> > > at jess.Funcall.execute(Unknown Source)
> > > at jess.FuncallValue.resolveValue(Unknown Source)
> > > at jess.ck.call(Unknown Source)
> > > at jess.d2.a(Unknown Source)
> > > at jess.Funcall.execute(Unknown Source)
> > > at jess.Jesp.a(Unknown Source)
> > > at jess.Jesp.char(Unknown Source)
> > > at jess.Jesp.parse(Unknown Source)
> > > at jess.Main.execute(Unknown Source)
> > > at jess.Main.main(Unknown Source)
> > >
> > > ________________________________________________________________
> > > Sven Schwarz Tel. : +49 (631) 205 3451
> > > Email : [EMAIL PROTECTED]
> > > WWW : http://www.dfki.uni-kl.de/~schwarz/
> > > ________________________________________________________________
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> > > ---------------------------------------------------------------------
> > >
> >
> > ---------------------------------------------------------
> > Ernest Friedman-Hill
> > Distributed Systems Research Phone: (925) 294-2154
> > Sandia National Labs FAX: (925) 294-2234
> > Org. 8920, MS 9012 [EMAIL PROTECTED]
> > PO Box 969 http://herzberg.ca.sandia.gov
> > Livermore, CA 94550
>
> --
> ________________________________________________________________
> Sven Schwarz Tel. : +49 (631) 205 3451
> Email : [EMAIL PROTECTED]
> WWW : http://www.dfki.uni-kl.de/~schwarz/
> ________________________________________________________________
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------