title: Unable to run .jar files by double-clicking them on Windows 7
body: <p>Running a .jar file in the command line works fine, but <strong>I am unable to execute .jar files on my PC by double-clicking them</strong>. What is interesting, the same .jar files successfully execute on my laptop with a double-click.</p>
  
  <p>I included <code>%JAVA_HOME\bin</code> and <code>JDK_HOME\bin</code> in the <code>PATH</code> variable.<br/>
  I have <code>JAVA_HOME</code> set to <code>C:\Program Files\Java\jre1.8.0_121</code>.<br/>
  I have <code>JDK_HOME</code>&nbsp;&nbsp; set to <code>C:\Program Files\Java\jdk1.8.0_121</code>.<br/></p>
  
  <p>For some period of time, the <em>Java(TM) Platform SE binary</em> disappeared from the <code>Open with</code> list, and I could not add it until I changed the <code>HKEY_CLASSES_ROOT\jar_auto_file\shell\open\command</code> key in <code>regedit.exe</code> to the appropriate version:</p>
  
  <blockquote>
    <p><em>C:\Program Files\Java\jre1.8.0_<strong>121</strong>\bin\javaw.exe" "%1".</em></p>
  </blockquote>
  
  <p><br/>
  Here is a snapshot of Windows CMD with <code>java -version</code> entered on my PC:<br/>
  <a href="https://i.stack.imgur.com/xSY1u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xSY1u.png" alt="java -version in Windows CMD"></a></p>
  
  <p><br/>
  <strong>I tried the following methods, with no success:</strong></p>
  
  <ul>
  <li>reinstalling both JRE and JDK,</li>
  <li>associating .jar files with <code>C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe</code>,</li>
  <li>using <code>assoc .jar=jarfile</code> and <code>ftype jarfile="C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe" -jar "%1" %*</code> in command line,</li>
  <li>creating a new system Environment Variable <strong>OPENDS_JAVA_ARGS</strong> and setting it to <em>-jar</em>.</li>
  </ul>
  
  <p><br/>
  <strong>Additional information:</strong></p>
  
  <ul>
  <li>I am using Windows 7 Professional 64-bit (Service Pack 1) with latest
  updates installed both on my PC and laptop.</li>
  <li>Running .jar files by double-clicking them <strong>used to work</strong> on my PC,
  but suddently stopped working some time ago. I did not modify
  anything related to Java.</li>
  <li>I have the newest version of both JRE and JDK (Java 8 version 121).</li>
  <li>Of the .jar files I am trying to run, some are GUI Swing applications
  and some open the system console (if not already open) using
  <code>Runtime.getRuntime().exec(String[])</code>.</li>
  </ul>
  
  <p><br/>
  <strong>I have already tried fixing this problem with solutions on the following links (without success):</strong></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/8511063/how-to-run-jar-file-by-double-click-on-windows-7-64">How to run .jar file by double click on Windows 7 (64)</a></li>
  <li><a href="https://stackoverflow.com/questions/19966394/how-to-open-run-jar-file-double-click-not-working">How to open/run .jar file (double-click not working)?</a></li>
  <li><a href="https://stackoverflow.com/questions/18434292/i-can-run-jar-files-through-cmd-but-i-cannot-double-click-them">I can run .jar files through cmd, but I cannot double click them</a></li>
  <li><a href="https://stackoverflow.com/questions/1724892/cant-run-jar-files">Can&#39;t Run JAR Files</a></li>
  </ul>
  
  <p><br/>
  <strong>Notes:</strong></p>
  
  <ul>
  <li>I do not want to open .jar files with WinRAR.</li>
  <li>I do not want to open .jar files by running <code>java -jar jarfile.jar</code> in cmd.exe.</li>
  <li>I am not looking for a 3rd party application to run .jar files.</li>
  </ul>
  
  <p><br/>
  <em>For now, I am using <code>C:\Windows\System32\cmd.exe /k "java -jar C:\path\to\jarfile\Program.jar"</code> as a shortcut location to run jar files, but I am not satisfied with this solution as this opens the console to run even Swing applications.</em></p>