title: How to minimize load time of JavaVM when a jar is called from Python?
body: <p>I'm using the <a href="https://developers.google.com/closure/compiler/docs/gettingstarted_app" rel="nofollow">Google Closure Compiler</a> jar file to minimize production JS files that reflect changes done by my clients. Every time a user click "Publish Changes" on the back end panel, it creates a system call to compiler.jar file - but every such call takes 4-6 seconds, regardless of the JS file size. After research I found that most of the delay is to load the JavaVM for each and every call. System is Ubuntu and Python.</p>
  
  <p>How can I keep the JavaVM constantly up and running and make it load the compiler.jar file every time a user click "Publish"?</p>
  
  <p>Python code:</p>
  
  <pre><code>import subprocess
  jarjs = os.path.join(ROOT_DIR, "compiler.jar")
  fn_output = fn_source.replace('.js','.min.js')
  p = subprocess.Popen(['java','-jar',jarjs,'--jscomp_off','internetExplorerChecks','--compilation_level','SIMPLE_OPTIMIZATIONS','--js',fn_source,'--js_output_file',fn_output], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
  out, err = p.communicate()
  </code></pre>
  
  <p><a href="http://plnkr.co/edit/3jqXhnp0pweCRAdWnBPv?p=preview" rel="nofollow">fuller code</a></p>