Its not necessary to set path. But you have to go to the directory whichcontains javac(compiler) and java, i.e. bin directory to compile and run theprogram.