Legolas

Legolas

  • NA
  • 81
  • 176.4k

Exception in thread "main"

Jul 22 2011 6:27 AM
hi,

In my java program, I am importing a package from a different location. So, I set the class path and import the package. The program is compiled successfully, but It show the following Exception while running it.

D:\>java Myprogram
Exception in thread "main" java.lang.NoClassDefFoundError: Myprogram
Caused by: java.lang.ClassNotFoundException: Myprogram
        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)
Could not find the main class: Myprogram.  Program will exit.

where, "Myprogram" is the name of my java source file as well as public class.

Please help!

Answers (1)