Q: Jabber, I tried to run some example code on my Windows 98. As I tried to compile the code, I got an error message saying "Bad commands or ....". What's wrong?

guest (jabber)
A: Let me say you are trying to compile a source file called "Hello.java".

Your commands may be as follows:

javac Hello.java

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 ....".

2000-8-31 -04:00

回到话题: Java Q&A (1)

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论