Hi Raza,
also, make sure that the Java statement is syntactically correct.
In your example you obviously want to execute the following Java
statement: "return (2==2);". Hence your eval invocation should probably
read:
Object o = manager.eval("java","",0,0,"return (2==2);");
HTH,
---rony
Raza, Rizwan (MLCI) wrote:
> Hi folks:
>
>
>
> How can I evaluate the string "2 == 2" in a java program. Is it
> possible?
>
>
>
> I did the following but it is throwing ClassNotFound exception
>
>
>
> BSFManager manager = new org.apache.bsf.BSFManager();
>
> Object o = manager.eval("","",0,0,"2==2");
>
> return o.toString();
>
>
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/logging/LogFactory
>
> at org.apache.bsf.BSFManager.<init>(BSFManager.java:102)
>
> at EvaluatorB.Evaluate(EvaluatorB.java:13)
>
> at Evaluator.main(Evaluator.java:8)
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.logging.LogFactory
>
> 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)
>
> ... 3 more
>
>
>
> I think I am missing some configuration file. Can someone please point
> me to the right direction?
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-user-help@jakarta.apache.org
|