I had a java file which need to be compiled and it was present in some other directory, i can compile it simply by specifying the full path where the java file is located but my problem is can i compile it by mentioning path to that java file in classpath
yes you can compile a java file present in some other directory then jdk you just need to assign the path of your directory then its folder and then just "javac ABC.java" and your filed will be compiled. you just need to provide a path in cmd and rest will be same like compiling and executing normal java file