When I run the java program it gives following error:
Exception in thread "main" java.lang.NoClassDefFoundError: check
Caused by: java.lang.ClassNotFoundException: check
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: check. Program will exit.
The source code is:
import java.io.*;
class check {
public static void main (String [] args)
{
System.out.println("Hello");
}
}
~
~
You’ve got the
CLASSPATHenvironment variable set, and it doesn’t include.(dot), the current directory. Try this(That’s java space dash cp space dot space check).