title: How to run .jar file using a specific JRE version from a .bat file?
body: <p>So I'm trying to run a jar file which requires Java 7. I installed java 7 JRE but when i use <code>java -jar...</code> its still using java 8.</p>
  
  <p>This is what I have in the <code>.bat</code> file I'm trying to run and <code>mcpc-plus-1.4.7.jar</code> is in the same folder as the <a href="/questions/tagged/batch-file" class="post-tag" title="show questions tagged &#39;batch-file&#39;" rel="tag">batch-file</a>.</p>
  
  <pre><code>"C:\Program Files\Java\jre7\bin\java.exe" -jar mcpc-plus-1.4.7.jar -Xms1G -Xmx2G -XX:MaxPermSize=256M nogui -nojline
  </code></pre>
  
  <p>One thing to note when I open the Command Prompt and run <code>java -jar ...</code> it works as it should, but it downloads and creates everything in the JRE location, which is not what I want.</p>
  
  <p>This is what I get after running the suggested commands within the comments.</p>
  
  <pre><code>Environment variable JAVA_HOME,  not defined
  
  C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
  C:\Windows\system32;C:\Windows;
  C:\Windows\System32\Wbem;
  C:\Windows\System32\WindowsPowerShell\v1.0\;
  C:\Windows\System32\OpenSSH\;
  C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;
  C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
  D:\Programs\brackets\command;
  C:\Users\...\AppData\Local\Microsoft\WindowsApps;
  C:\Users\...\AppData\Local\GitHubDesktop\bin;
  D:\Programs\Nmap)
  </code></pre>