title: Set JVM heap space when I use javax.tools.JavaCompiler
body: <p>I'm using the JavaCompiler APIs to compile some Java source code.
  However, I'm getting OutOfMemoryError exceptions. I tried to use the -Xmx1G options, but it does not work:</p>
  
  <pre><code>java.lang.IllegalArgumentException: invalid flag: -J-Xmx1G
      at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:236)
      at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:207)
      at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:53)
  </code></pre>
  
  <p>Has anyone successfully increased the heap size setting the correct options? I also unsuccessfully tried:</p>
  
  <p>Xmx1G</p>
  
  <p>-Xmx1G</p>
  
  <p>J-Xmx1G</p>
  
  <p>-J -Xmx1G</p>
  
  <p>-J Xmx1G</p>