title: Run application via gradlew with -Xmx and -Xms
body: <p>I have an application. I run it via</p>
  
  <pre><code>gradlew run-app
  </code></pre>
  
  <p>Or debug </p>
  
  <pre><code>gradlew debug-app
  </code></pre>
  
  <p>It works. How do I pass '-Xmx' argument into the application which I run (debug)?
  Is it possible to do so without edditing <code>build.gradle</code> file?</p>
  
  <p>I found this
  <a href="https://stackoverflow.com/questions/28172021/gradle-unknown-command-line-option-x">Gradle unknown command-line option &#39;-X&#39;</a></p>
  
  <p>I get a similar error when I try</p>
  
  <pre><code>gradlew debug-app -Xmx2000m
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Problem configuring task :debug-app from command line.
  &gt; Unknown command-line option '-X'.
  </code></pre>
  
  <hr>
  
  <p>I tried to create a file <code>gradle.properties</code> in <code>GRADLE_USER_HOME</code> directory (by default, it is USER_HOME/.gradle).</p>
  
  <pre><code>org.gradle.jvmargs=-XX\:MaxHeapSize\=4256m -Xmx4256m -Xms2000m
  </code></pre>
  
  <p>I also tried to <code>org.gradle.jvmargs=-Xmx2000m</code> in project folder <code>gradle.properties</code>.</p>
  
  <p>And even then when I run an application, I see Commited Memory size is &lt; 520 MiB</p>
  
  <p><a href="https://i.stack.imgur.com/PSzq2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PSzq2.png" alt="enter image description here"></a></p>
  
  <p>And this is when I run it as a normal Java App</p>
  
  <p><a href="https://i.stack.imgur.com/NB3Ad.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NB3Ad.png" alt="enter image description here"></a></p>
  
  <p>In the second case, when I run the application as a normal Java app with -Xms, -Xmx, Commited Memory size is about 3.5 GiB because I passed <code>-Xmx4512m -Xms2512m</code> parameters.</p>