I have a
java source file in a path, when I compile this source file by typing path to this file and also path to javacon cmd prompt , it compile and classfile is generated in same location where source file is.
Now when I am trying to execute classfile by typing path to class file and also path to java exe file on cmd prompt , I am getting main not found error as below
C:\Users\um2t\Desktop\Java>"C:\Program Files\java\jdk1.5.0_22\bin\javac" "C:\Users\um2t\Desktop\Java\TestPath.java"
C:\Users\um2t\Desktop\Java>"C:\Program Files\java\jdk1.5.0_22\jre\bin\java" "C:\Users\um2t\Desktop\Java\TestPath"
Exception in thread "main" java.lang.NoClassDefFoundError: C:\Users\um2t\Desktop\Java\TestPath
DO I have to have classpath setup for class file to be execured ? Can a classfile not run by typing path on cmd prompt ? If so, why ?