<p>Java SE Development Kit 8u112 on a 64-bit Windows 7 or Windows 8</p>
<p>Set the following <em>user environment variables</em> (== environment variables of type <em>user variables</em>)</p>
<ul>
<li>
<p><code>JAVA_HOME :</code> <code>C:\Program Files\Java\jdk1.8.0_112</code></p>
</li>
<li>
<p><code>JDK_HOME :</code> <code>%JAVA_HOME%</code></p>
</li>
<li>
<p><code>JRE_HOME :</code> <code>%JAVA_HOME%\jre</code></p>
</li>
<li>
<p><code>CLASSPATH :</code> <code>.;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib</code></p>
</li>
<li>
<p><code>PATH :</code> <code>your-unique-entries;%JAVA_HOME%\bin</code> (make sure that the longish <code>your-unique-entries</code> does not contain any other references to another Java installation folder.</p>
</li>
</ul>
<p>Note for Windows users on 64-bit systems:</p>
<pre><code class="lang-auto">Progra1 = 'Program Files'
Progra2 = 'Program Files(x86)'
</code></pre>
<p>Notice that these environment variables are derived from the “root” environment variable <code>JAVA_HOME</code>. This makes it easy to update your environment variables when updating the JDK. Just point <code>JAVA_HOME</code> to the fresh installation.</p>
<p><a href="http://gedankenverlust.blogspot.de/2012/05/java-environment-variables-definitive.html">There is a blogpost explaining the rationale behind all these environment variables</a>.</p>
<p>Optional recommendations</p>
<ul>
<li>
<p>Add a <em>user environment variable</em> <code>JAVA_TOOL_OPTIONS</code> with value <code>-Dfile.encoding="UTF-8"</code>. This ensures that Java (and tools such as <em>Maven</em>) will run with a <code>Charset.defaultCharset()</code> of <code>UTF-8</code> (instead of the default <code>Windows-1252</code>). This has saved a lot of headaches when wirking with my own code and that of others, which unfortunately often assume the (sane) default encoding <em>UTF-8</em>.</p>
</li>
<li>
<p>When JDK is installed, it adds to the <em>system environment variable</em> <code>Path</code> an entry <code>C:\ProgramData\Oracle\Java\javapath;</code>. I anecdotally noticed that the links in that directory didn’t get updated during an JDK installation update. So it’s best to remove <code>C:\ProgramData\Oracle\Java\javapath;</code> from the <code>Path</code> system environment variable in order to have a consistent environment.</p>
</li>
</ul>