I did following.
I kept my source code directly under C:\
At the cmd prompt, I executed following exe file "C:\Program Files\Java\jdk1.6.0_11\bin>javac c:\AnyClass.java" So the source code did compile and class file is created under c directory.
Now when I do "C:\Program Files\Java\jdk1.6.0_11\bin>java c:\AnyClass"., I get following error
------------------------------------------------------------------------------------
C:\Program Files\Java\jdk1.6.0_11\bin>java c:\AnyClass
Exception in
thread "main" java.lang.NoClassDefFoundError: c:\AnyClass
Caused by: java.lang.ClassNotFoundException: c:\AnyClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: c:\AnyClass. Program will exit.
------------------------------------------------------------------------------------------
I tried to keep classfile in different folder and try to execute from there, but same error.
Whats this due to ? How to correct this ?