Javac is not found
Asked Answered
G

8

32

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\bin

I have tried both with and without ';' but to no avail.

I recently had this issue on my desktop and adding ; worked but it's not in this case.

I have made sure that javac does exist in the bin too.

Any suggestions on fixes would be greatly appreciated.

EDITS echo %PATH% gives:

C:\Users\Arktri\Desktop>echo %PATH%

C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;;
C:\Program Files (x86)\Java\jre7\bin

And the exact error is: 'javac' is not recognized as an internal or external command, operable program or batch file.

Grandee answered 22/3, 2013 at 16:51 Comment(5)
can you start a shell, type echo %PATH% and post results?Shetrit
What is the error that you see? Saying "I can not get [it] to work" doesn't tell us anything about the problem.Prothalamion
The double semicolons might be a problem.Fadge
Do you have an extra space in you path? I can see: Pr ogram Files there...Cage
confluence.atlassian.com/display/DOC/…Sascha
V
46

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.

Viehmann answered 22/3, 2013 at 17:3 Comment(2)
Could you include here the information how to do it permanently?Pero
I should have when I first posted this answer, but I suggest taking a look at @user4611364 answer below. Doing it that way will set it permanently (assuming you're using windows)Viehmann
C
29
  1. Go to my computer;
  2. Right click properties;
  3. Go to advanced system settings;
  4. Go to environment variables;
  5. In user variables for user click on new(top new button, not on system variables);
  6. Set variable name as: Path
  7. Set the value of that variable to: C:\Program Files\Java\jdk1.7.0_76\bin
  8. Click ok;
  9. Click ok;
  10. Click ok.

Now you're set. Type javac in cmd. All javac options will be displayed.

EDIT: As @MediaMaker pointed out, after completing the above steps, you need to open a new command prompt for it to work.

Castellan answered 26/2, 2015 at 17:14 Comment(1)
note that if you already have a cmd open and try to use that, it won't seem to work. You'll need to open a fresh cmd.Robenarobenia
N
2

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.

Nun answered 30/1, 2016 at 3:4 Comment(0)
A
1

I'm searched many answers that suggest me to type in cmd:

set path = "%path%;c:program files\java\jdk1.7.0\bin"

but this is WRONG!

the right solution is that you leave "set" and just type

path = %path%;c:program files\java\jdk1.7.0\bin

P/s: of course you have to replace "jdk1.7.0" folder by your current java version folder. This works well on win 7 32bit, but I think it also works on win 8 - try it!

Adalia answered 8/4, 2013 at 16:1 Comment(0)
T
0

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.

Tophole answered 22/3, 2013 at 16:56 Comment(0)
C
0

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.

Cage answered 22/3, 2013 at 17:4 Comment(0)
A
0

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.

Argosy answered 26/10, 2015 at 23:45 Comment(0)
C
0

Just type enviormental vairables in start menu, and you will see

Edit the system enviormental...,

click enviromental variables

click in user vairables list:

Path (ONCE)

Click New

Copy & Paste You're Bin directory for the jdk.

e.g. C:\Program Files\Java\jdk-1.8\bin

Hit Enter

Open New CMD

Type 'javac'

Cinquefoil answered 30/5, 2023 at 23:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.