title: Python : javabridge virtual machine only works once
body: <p>I need to use bioformats-python to read microscope images. To use it a Java VM is needed.</p>
  
  <p><strong>I can only use java VM once</strong>, if I execute again my python script I get an error.</p>
  
  <p><strong>If I restart the spyder kernel, the script works only once again.</strong></p>
  
  <p>I installed the JDK (8u181) and setted up the path variables.
  I use Spyder with python 3.6.</p>
  
  <p>Here is the code I used to test the java VM : </p>
  
  <pre><code>import javabridge
  
  javabridge.start_vm(run_headless=True)
  try:
      print(javabridge.run_script('java.lang.String.format("Hello, %s!", greetee);',
                                  dict(greetee='world')))
  finally:
      javabridge.kill_vm()
  </code></pre>
  
  <p>What I obtained the first time of execution :</p>
  
  <pre><code>&gt;&gt;&gt; Hello, world!
  </code></pre>
  
  <p>And this is the <strong>error message</strong> I get when I try to run it a second time :</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\Z820\Miniconda3\envs\py37\lib\site-packages\javabridge\jutil.py", line 281, in start_thread
      env = vm.create(args)
    File "_javabridge.pyx", line 653, in _javabridge.JB_VM.create
  RuntimeError: Failed to create Java VM. Return code = -1
  Failed to create Java VM
  Traceback (most recent call last):
  
    File "&lt;ipython-input-2-81778b2b637e&gt;", line 1, in &lt;module&gt;
      runfile('C:/Users/Z820/Desktop/Python/Fichier_Python/Projet_correlation/Replace Fiji/usebioformas.py', wdir='C:/Users/Z820/Desktop/Python/Fichier_Python/Projet_correlation/Replace Fiji')
  
    File "C:\Users\Z820\Miniconda3\envs\py37\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 678, in runfile
      execfile(filename, namespace)
  
    File "C:\Users\Z820\Miniconda3\envs\py37\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 106, in execfile
      exec(compile(f.read(), filename, 'exec'), namespace)
  
    File "C:/Users/Z820/Desktop/Python/Fichier_Python/Projet_correlation/Replace Fiji/usebioformas.py", line 10, in &lt;module&gt;
      javabridge.start_vm(run_headless=True)
  
    File "C:\Users\Z820\Miniconda3\envs\py37\lib\site-packages\javabridge\jutil.py", line 314, in start_vm
      raise RuntimeError("Failed to start Java VM")
  
  RuntimeError: Failed to start Java VM
  </code></pre>
  
  <p>If I try to launch it a third time, I get a slightly different error message.</p>
  
  <p>Does anyone have an idea to solve this problem ?</p>
  
  <p>I thank you in advance for your help,</p>
  
  <p>Thomas.</p>