title: Update -XX:MaxPermSize to -XX:MaxMetaspaceSize via batch file
body: <p>Our installer updates our application from using java7 to java8. In doing so, we'd like to update their <strong>Tomcat7</strong> configuration to limit the Metaspace at the same level as their PermGen space (which they might have customized). So if they had...</p>
  
  <pre><code>-XX:MaxPermSize=256m
  </code></pre>
  
  <p>we'd like to set...</p>
  
  <pre><code>-XX:MaxMetaspaceSize=256m
  </code></pre>
  
  <p>The trick is, <strong>the installer must do this via a batch file</strong>. (Perhaps querying Tomcat with some command that would spit out the present value to a file, and then read that value in, and then fire off another command to set the value.)</p>
  
  <p>If I can get the present <code>MaxPermSize</code>, I know that last piece of the puzzle:</p>
  
  <pre><code>"%TOMCAT7_EXE%" %SERVICE_NAME% --JvmOptions "-XX:MaxMetaspaceSize=%MAX_SIZE%"
  </code></pre>
  
  <p>(It might also be nice to remove the no longer applicable <code>MaxPermSize</code>, but that would be just for extra-credit.)</p>