A: Let me say you are trying to compile a source file called "Hello.java".
Your commands may be as follows:
Here is the mechanism how things go on. Your computer will try to find Java compiler, i.e., javac.exe, according to an environment variable called PATH. Ususally, if you install JDK at disk C, your Java compiler (javac.exe) resides at
The error message implies that your PATH does not contain C:\jdk1.2.2\bin, so your computer cannot find Java compiler. Then, it complained that javac is a bad command because it does not understand "javac".
To check your problem, you can type "echo %PATH%" in MS-DOS. Then, you will see your full PATH.
To remedy your probelm, you can re-set PATH by your self. In MS-DOS, issue the command "set PATH=C:\jdk1.2.2\bin". Then, compile your example code and the machine won't compile so-called "Bad command ....".