title: Setting VM Options in JAR (-Xmx) [JVM Startup Parameters]
body: <p>I searched for this question and got many many matches on stackoverflow itself, but the answers in there are sort of contradicting.</p>
  
  <p>In Ques: <a href="https://stackoverflow.com/questions/2893894/how-to-add-vm-options-to-jar">How to add VM options to jar?</a> the top-voted+accepted says it is not possible and also most of the answers in Ques: <a href="https://stackoverflow.com/questions/1018217/can-i-set-java-max-heap-size-for-running-from-a-jar-file">Can I set Java max heap size for running from a jar file?</a> say that No, it is not possible. Most of these answers saying "not possible" were given by people with high reputation and therefore I assume they cannot all be just wrong by coincidence. </p>
  
  <p>One guy said that it can be done by using <a href="http://silentdevelopment.blogspot.in/2010/03/how-to-set-or-increase-xmx-heap-memory.html" rel="nofollow noreferrer">this </a> others said to make a installer for it, or use Launch4J or make batch files or make another JAR and run the main through this but most of these did not get many votes as compared to those saying "no".</p>
  
  <p>So is it really possible or not? My problem is that I run out of heap space and therefore I want to increase it in JAR.</p>
  
  <p><strong>Q1. I have set increased Heap space from netbeans, will it be increased in the JAR too? (I think no, I am just confirming this one)<br /><br />
  Q2. What should I do now to make the increased heap space in JAR? (I am looking for an easy to do way because I do not have knowledge about batch scripting and all and also that I am already putting an Installer to place these files(Advanced Installer) so I do not want to put additional Installers to do this) Is there a simple way out?</strong></p>