-1
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_31
PATH = %JAVA_HOME%\bin;
CLASSPATH=%JAVA_HOME%\lib;.;

In cmd, java -version is working fine but javac is not. It is giving error.

Andrew Spencer
  • 15,164
  • 4
  • 29
  • 48
Shiva Garg
  • 826
  • 9
  • 17
  • Can you echo %JAVA_HOME% and what is the output of `java -version`? – Jens May 26 '15 at 09:45
  • Knowing the error would be helpful! ;-). Would you post the error message, please. – Peter Paul Kiefer May 26 '15 at 09:49
  • Do not add `%JAVA_HOME%\lib` to your classpath. – Jesper May 26 '15 at 09:50
  • C:\>echo %java_home% C:\Program Files\Java\jdk1.8.0_31 C:\>java -version java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) Client VM (build 25.31-b07, mixed mode, sharing) C:\>echo %path% C:\ProgramData\Oracle\Java\javapath;%JAVA_HOME%\bin;E:\app\SH259935\product\11.2 .0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windo ws\System32\WindowsPowerShell\v1.0\;%ANT_HOME%\bin;%CATALINA_HOME%\bin; C:\>javac 'javac' is not recognized as an internal or external command, operable program or batch file. C:\> – Shiva Garg May 26 '15 at 10:05

1 Answers1

0

You need the syntax set JAVA_HOME=[path] (with no spaces)

If it's a Linux/Unix shell then JAVA_HOME=[path]

Try this

JAVA_HOME = C:\Program Files\Java\jdk1.8.0_31
echo %JAVA_HOME%
PATH = %JAVA_HOME%\bin;
echo %PATH%

Possible explanation for this behaviour: you have a JRE 1.8.0_31 somewhere else on your path, this is why java is working but not javac.

Andrew Spencer
  • 15,164
  • 4
  • 29
  • 48