I tried to compile and run the following java code.
import javax.script.*;
public class Script {
public static void main(String[] args) throws Exception {
// create a script engine manager
ScriptEngineManager factory = new ScriptEngineManager();
// create a Javascript engine
ScriptEngine engine = factory.getEngineByName("Javascript");
// evaluate Javascript code from String
engine.evaal("print('Hello, World')");
}
}
It is compiling well and the class file is created.but when running the code it shows the following error:
Quote
Exception in thread "main" java.lang.NoClassDefFoundError: Script Caused by: java.lang.ClassNotFoundException: Script 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)
please tell me where am i wrong.Thanks

New Topic/Question
This topic is locked




MultiQuote




|