0

jdk1.8.0_92 is installed in my Windows 7 and was able to set the path variable but didn't work, so I tried something but still keeps on giving me the same error. In my cmd it says this: javac is not recognized as an internal or external command

I have set JAVA_HOME and PATH variable. path looks like this:

%JAVA_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files     
(x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS 
Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROO 
T%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R)  
Management Engine Components\DAL;C:\Program Files (x86)\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\IPT;C:\Program Files (x86)\Skype\Phone\;C:\Program   
Files\OpenVPN\bin;C:\Program Files\TortoiseSVN\bin

JAVA_HOME looks like this:

C:\Program Files\Java\jdk1.8.0_92

CLASSPATH looks like this:

.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;C:\Program Files\Java\jdk1.8.0_92\lib;C:\Program Files\Java\jdk1.8.0_92\jre\lib

Any suggestion how to fix this ?

stefansaye
  • 135
  • 1
  • 3
  • 16

3 Answers3

6

In classpath, the correct way to set Java is C:\Program Files\Java\jdk1.8.0_92\bin;

if your java is installed in C:\Program Files\Java\jdk1.8.0_92 directory.

so instead of C:\Program Files\Java\jdk1.8.0_92\lib;C:\Program Files\Java\jdk1.8.0_92\jre\lib in your classpath, add the one I posted above.

And one thing, after setting it, open a new command line to execute javac as it in not picked by currently opened window.

Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
Zulfiqar
  • 86
  • 4
0

Maybe change

C:\Program Files\Java\jdk1.8.0_92\jre\lib

to

C:\Program Files\Java\jdk1.8.0_92\bin

The javac exe is a JDK program, and the file path you reffered to is a JRE program folder provided with the JDK

Lightfire228
  • 546
  • 1
  • 5
  • 17
  • for me JAVA_HOME looks ok. In the Path he refer to the bin folder. %JAVA_HOME%\bin – Patrick May 11 '16 at 06:41
  • @Patrick As soon as i posted that edit, i looked at that and realized he had included the `\bin` in the path variable, so i removed the edit – Lightfire228 May 11 '16 at 06:42
0

Your class path should be %JAVA_HOME%\bin;

Once you install java in your machine, to set JAVA_HOME you should refer bin folder not lib folder.

Bhargav Kumar R
  • 2,190
  • 3
  • 22
  • 38