title: Ant javac invalid flag -J-Xms<size>
body: <p>I am trying to do build one of my projects using ant and I am getting following error </p>
  
  <pre><code>    [javac] javac: invalid flag: -J-Xms512m
      [javac] Usage: javac &lt;options&gt; &lt;source files&gt;
  </code></pre>
  
  <p>And this is what my .xml file looks like</p>
  
  <p>Relevant portion only:</p>
  
  <pre><code>   &lt;javac srcdir="MY_SRC_DIR"&gt;
              &lt;compilerarg value="-J-Xms512M" /&gt;
              &lt;compilerarg value="-J-Xmx512M" /&gt;
     &lt;/javac&gt;
  </code></pre>
  
  <p>Tried following other options and I still see same error as above</p>
  
  <p>[1] Tried a white space between -J and -Xms</p>
  
  <p>[2] Tried using compilerarg line="-J-Xms512m -J-Xmx512m"</p>
  
  <p>[3] Tried using memoryinitialsize and memorymaximumsize instead of compiler options.</p>
  
  <p>javac -version
  javac 1.6.0_51</p>
  
  <p>Tried this on command line and it works fine</p>
  
  <pre><code> javac -J-Xms512m -J-Xmx512m Blah.java
  </code></pre>
  
  <p>Any help would be appreciated</p>