title: JAVA_HOME has been set, but java - version cannot be found in command prompt
body: <p>[EDITED]</p>
  
  <p>I have set my JAVA_HOME variable to "C:\Program Files\Java\jdk1.8.0_60\"</p>
  
  <p>and after running javac -version on Command Prompt , i get this:</p>
  
  <pre><code>javac 1.7.0_07
  </code></pre>
  
  <p>However when i run java-version , i get this:</p>
  
  <pre><code>C:\Users\User\Desktop&gt;java -version
  Error: Failed reading value of registry key:
      Software\JavaSoft\Java Runtime Environment\C
  Error: could not find java.dll
  Error: Could not find Java SE Runtime Environment.
  </code></pre>
  
  <p>To clarify, i have the following files in my C:\Program Files\Java</p>
  
  <p>(1) jdk1.5.0_14  (this file cannot be deleted, as its said to be in use by the system</p>
  
  <p>(2) jdk1.8.0_60</p>
  
  <p>(3) jre1.5.0_14</p>
  
  <p>(4) jre1.8.0_60</p>
  
  <p>May i know how to ensure that all jre and jdk points to the 1.8 version; and also how to get rid of the above mentioned error?</p>
  
  <p>I get this upon echoing %PATH%:</p>
  
  <pre><code>C:\ProgramData\Oracle\Java\javapath;C:\Users\User\introcs\java\bin;C:\PROGRAM FI
  LES\BROADCOM\BROADCOM 802.11 NETWORK ADAPTER;C:\PROGRAM FILES (X86)\NVIDIA CORPO
  RATION\PHYSX\COMMON;C:\PROGRAM FILES (X86)\INTEL\ICLS CLIENT\;C:\PROGRAM FILES\I
  NTEL\ICLS CLIENT\;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\WIN
  DOWS\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT
   ENGINE COMPONENTS\DAL;C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONE
  NTS\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)\INTEL\OPENCL SDK\2.0\BIN\X86;C:\PROGRAM FILES (X86)\INTEL\OPENCL SD
  K\2.0\BIN\X64;C:\PROGRAM FILES\SONY\VAIO IMPROVEMENT;C:\PROGRAM FILES (X86)\SONY
  \VAIO BIOS DATA TRANSFER UTILITY\;C:\PROGRAM FILES (X86)\SONY\VAIO STARTUP SETTI
  NG TOOL;;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\WINDOWS\SYST
  EM32\WINDOWSPOWERSHELL\V1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Pro
  gram Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\Windows Ki
  ts\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\To
  ols\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementS
  tudio\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Fi
  les (x86)\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files\Microsoft SQL Serv
  er\110\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Users\User\introcs\j3d\b
  in;C:\Users\User\introcs\bin;C:\Users\User\introcs\java\bin;
  </code></pre>