I\'m running Windows 8 and I can not get javac to work.
I have set my PATH in environmental variables to
C:\\Program Files (x86)\\Java\\jdk1.7.0_17\\
You don't have jdk1.7.0_17 in your PATH - check again. There is only JRE which may not contain 'javac' compiler.
Besides it is best to set JAVA_HOME variable, and then include it in PATH.
Start off by opening a cmd.exe session, changing directory to the "program files" directory that has the javac.exe executable and running .\javac.exe.
If that doesn't work, reinstall java. If that works, odds are you will find (in doing that task) that you've installed a 64 bit javac.exe
, or a slightly different release number of javac.exe
, or in a different drive, etc. and selecting the right entry in your path will become child's play.
Only use the semicolon between directories in the PATH environment variable, and remember that in some systems, you need to log out and log back in before the new environment variable is accessible to all environments.
As far as I can see you have the JRE
in your PATH
, but not the JDK
.
From a command prompt try this:
set PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.7.0_17\bin
Then try javac
again - if this works you'll need to permanently modify your environment variables to have PATH
include the JDK
too.
Path
C:\Program Files\Java\jdk1.7.0_76\bin
Now you're set. Type javac
in cmd. All javac options will be displayed.
Easiest way: search for javac.exe in windows search bar. Then copy and paste the entire folder name and add it into the environmental variables path in advanced system settings.
do this: 1. run CMD (WIN+R then type in CMD) 2. Type this:
set PATH=%PATH%; java installation path\bin
Replace "java installation path" with the directory JDK is installed in, such as C:\Program Files (x86)\Java. Be sure to add the \bin after the JDK directory, because this points to "javac" and "java" (BIN stands for "binaries")
This way, you can run the Java compiler from anywhere. It is impossible to CD to the JDK directory because it has a space in Program Files, and DOS will not let you CD to these directories.