if you want use java and javac Command for all directory can define PATH and CLASSPATH Var in OS's Environment variables that CLASSPATH for JDK's home directory and PATH for BIN folder of JDK's directory for example:
var name: PATH
var value: .;%PATH%;"C:\Program Files\Java\jdk1.5.0\bin"