Divya Gopinath wrote:Hello Everyone,
I have set my JAVA_HOME variable as E:\Program Files\Java\jdk1.6.0_21(system variable)
When I try to compile a simple program(which is in a folder called myproj) with this command -- E:\myproj\javac Ex.java -- it compiles fine. But when I try to run to run it, I am getting this error:: xampl
Program is like this::
public class Ex{
public static void main(String[] args){
System.out.println("hii");
}
}
E:\myproj>java Ex
Exception in thread "main" java.lang.NoClassDefFoundError: Ex
Caused by: java.lang.ClassNotFoundException: Ex
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: Ex. Program will exit.
Please help.
Regards,
Divya
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
naved momin wrote:
add this in your classpath or environment variables
Campbell Ritchie wrote:Agree. There are so many people and books telling you to set a system classpath, but that advice is mistaken.
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
naved momin wrote:
Campbell Ritchie wrote:Agree. There are so many people and books telling you to set a system classpath, but that advice is mistaken.
can you elaborate your point why doing this is a mistake ?