0

What are the path variable supposed to be to ensure "javac" will work? Should it be in both system and user variables and should the "\bin" part be included?

I have a Program Files and Program Files(x86) and the JDK is in both. Which one should i use? Eclipse is working perfectly, it's only when using command line that I get this. Anyone?

user992804
  • 329
  • 1
  • 6
  • 13
  • There is a 32-bit and a 64-bit version of each JDK version. You probably installed both kinds. Program Files is for the 64-bit programs, and Program Files(x86) for the 32-bit ones. Pick the one you want. – JB Nizet Oct 13 '11 at 06:47
  • 1
    possible duplicate of [javac not working in windows command prompt](http://stackoverflow.com/questions/1678520/javac-not-working-in-windows-command-prompt) – Joachim Sauer Oct 13 '11 at 06:47

1 Answers1

3

Eclipse comes with its own Java compiler, it doesn't have to use an external one.

You should find the bin directory under whichever JDK you want to use and then add it to the path (I prefer the user path but, since I only ever run as one user, I'm not sure what the difference is).

And make sure it's the JDK, not just the JRE.

For example, mine is in c:\program files\java\jdk1.6.0_17\bin (32-bit WinXP).

One final thing, if you're changing the environment variables in the control panel, that won't affect cmd windows that are already open. You'll need to open up a new one to get the new environment settings (trap for wary players).

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • Thanks, that makes sense. I put it in both the user and system variables, but it's still not working. I'm running 64-bit Windows 7, don't know if that makes a difference. It does work when I type out the whole path to the javac.exe file in command line.. so it's seems as if it's not picking up the path to the javac file or something. Any suggestions? – user992804 Oct 13 '11 at 07:07
  • It seems that closing cmd first worked :) saw that a bit late. Thanks a lot!! – user992804 Oct 13 '11 at 07:15