# [SOLVED] Java command prompt problem



## Tecnoob (Jan 10, 2008)

I am learning to program in Java using the JDK, the notepad, and the windows command prompt. Every time I try to use the javac command, it says:

'javac' is not recognized as an internal or external command, operable program or batch file.

I have been able to get it to compile by putting the whole path in manually like this:

"C:\Program Files\Java\jdk1.6.0_16\bin\javac" Hello.java

The teacher anticipated that we would get this sort of problem so he posted this as a fix:



> If this works (Windows can now find javac), then Java is installed correctly. Now you can update your path so you don't have to type the whole path name every time. These are the steps to do this in WindowsXP (some translation may be required for Vista):
> 
> 1. Go to Start -> Control Panel -> System. (It's easiest to find System when you change Control Panel to Classic View.)
> 2. Go to the Advanced tab
> ...


I have tried doing this but it still won't work. It gives the same error. I think I did it correctly in the first image. And the other image has the folder containing javac.exe, and the path at the top.


----------



## ahmorrow (May 5, 2009)

*Re: Java command prompt problem*

Have you tried it with the extension? i.e. 'javac.exe' instead of just 'javac'?


----------



## TheOutcaste (Mar 19, 2009)

*Re: Java command prompt problem*

It looks to me like you have a space between the *;* and the *C:\Program Files\Java\jdk1.6.0_16\bin\*.
If there is a space there it won't work


----------



## ahmorrow (May 5, 2009)

*Re: Java command prompt problem*

So it's "*\;C:\Program Files\Java\jdk1.6.0_16\bin\javac*" right? I've never used notepad to compile java. Now that I'm running a linux box it will likely never happen


----------



## TheOutcaste (Mar 19, 2009)

*Re: Java command prompt problem*

Yes, no space after the ;


----------



## Tecnoob (Jan 10, 2008)

*Re: Java command prompt problem*

Thanks, it works now.


----------



## TheOutcaste (Mar 19, 2009)

*Re: Java command prompt problem*



ahmorrow said:


> So it's "*\;C:\Program Files\Java\jdk1.6.0_16\bin\javac*" right? I've never used notepad to compile java. Now that I'm running a linux box it will likely never happen


Opps, missed the tail end of this, it just *\;C:\Program Files\Java\jdk1.6.0_16\bin*
The trailing slash is optional, it can be omitted or left in, but you can't include the file name *javac*. The path statement is always just folders. And there is more to the left of the first \, it's just not visible in the screen shot. At a minimum you would have this for the Path variable in Windows:

*C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Java\jdk1.6.0_16\bin*


Glad it's working for you now Tecnoob!

If your issue has been resolved you can mark this thread Solved by using the Thread Tools at the Top Right of this thread (above the first post) :grin:

Jerry


----------



## ahmorrow (May 5, 2009)

Sweet... I'll keep this in mind if I EVER switch back to a PC. Not likely, but good to know.


----------

