3 Replies - 1783 Views - Last Post: 23 September 2008 - 03:59 AM Rate Topic: -----

#1 nila  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 156
  • Joined: 05-January 08

Exception in thread "main" java.lang.NoClassDefFoundError

Posted 23 September 2008 - 02:32 AM

Hi,
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

Is This A Good Question/Topic? 0
  • +

Replies To: Exception in thread "main" java.lang.NoClassDefFoundError

#2 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted 23 September 2008 - 02:53 AM

Are you running it from a console?
Also please specify how are you doing it!
Was This Post Helpful? 0
  • +
  • -

#3 nila  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 156
  • Joined: 05-January 08

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted 23 September 2008 - 03:40 AM

yes.i am running it from the console.classpath was the problem and now i have solved it.Thanks
Was This Post Helpful? 0
  • +
  • -

#4 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted 23 September 2008 - 03:59 AM

no problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1