Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So, I am trying to learn java. I installed the JDK and proceeded to write a few programs. Each time, I have to give the path to javac.exe to compile the .java file.

SO, I decided to tweak the %PATH% variable.

And no matter what I change it to, it doesn't work.

when I do an echo %PATH%, I get 'Program' is not recognized as an internal or external command, operable program or batch file.

This is my Path variable contents : C:\app\product\11.1.0\client_1\bin;%CommonProgramFiles%\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;"C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\";"C:\Program Files\Broadcom\Broadcom 802.11";"C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\";"C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\";"C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\";"C:\Program Files (x86)\Roxio\OEM\AudioCore\";"C:\Program Files (x86)\Intel\Services\IPT\"

How do I work around this? the double quotes were not there before, I added it thinking the space was the problem.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Take chunks of that stuff in the PATH and put it in another environment variable.

Then just create a simple PATH with c:\;c:\windows;c:\windows\system32;c:\jdk

(c:\jdk if javac.exe is there)

You can try adding bits of it into the PATH as a troubleshooting step until you find the error. Like once you have all that into a new environment variable, take half of it paste it on the end of PATH, see if it functions fine. If so add more, if not then remove what you added, and add less.

At root, your troubleshooting logic is right but you are wrong. You say "no matter what I change it to, it doesn't work" . But you didn't try a simple short minimalistic PATH.

And indeed, remove the quotes. Space is fine because ; is the delimiter. Also you say you get that error "Program is not a recognized"

C:\Program Files\Vim>%PATH%
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

I can get that message too, but as you know really, you want to type echo %PATH% Not just %PATH% ! That was probably the cause of that error message

Also by the way, if I go to your post and literally copy the thing to the clipboard. then I open a command prompt type set a= Then I paste it in and push ENTER. Then I do echo %a% it displays fine. (you should still remove quotes permanently and if you have more problems then temporarily make it very short - as a troubleshooting step)

share|improve this answer

All paths are semicolon separated so you shouldn't use quotes. Also make sure all paths in your PATH actually exists, might not be your problem but this sometimes cause problems.

share|improve this answer

There quotes in PATH make no sense. Mine PATH has no quotes (directories with spaces are there).

Get rid of them and see if it works.

Also it's a good idea to ged rid of everything with % sign except %SystemRoot%. Also "\;" -> ";"

share|improve this answer
    
I removed all the quotes, btu still when I do echo %PATH%, it says 'Program' is an unrecognized command –  roymustang86 Nov 15 '11 at 18:35
    
Copy and paste the new path without quotes. It now sounds like there is a typo. –  surfasb Nov 16 '11 at 8:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.