title: Flex compiler, mxmlc, called in Java makes 64bits JVM crash (dcpr.dll)
body: <p>I have a web application that converts SVG files into swf ones.
  In order to do so, there are 3 steps :
  1 - Running through SVG Files in a folder</p>
  
  <pre><code>for (final File file : tFiles) {
  final String fileName = file.getName();
  
        final int nbEr = flashEngine.convert(fileName);
        if (nbEr &gt; 0) {
              LOG.error("Error with SVG file : " + fileName);
        }
  file.delete();
  }
  </code></pre>
  
  <p>2 - Converting each SVG in a .AS temporary file and adding info in it</p>
  
  <pre><code>public final int convert(final String svgName) {
      // *****************
      // DIVERS TREATMENTS
      // *****************
      final int nbError = computeSwf(svgName);
  
      // ******************
      // DIVERS TREATMENTS
      // ******************
      return nbError;
  }
  </code></pre>
  
  <p>3 - Converting th .as into .swf thanks to Mxmlc compiler</p>
  
  <pre><code>private int computeSwf(final String svgName) {
      final String[] argscompiler = new String[5];
      argscompiler[0] = "+flexlib";
      argscompiler[1] = [flex framework path : /flex/frameworks];
      argscompiler[2] = [temporary .as file path];
      argscompiler[3] = "-output"; // output folder path
      argscompiler[4] = [output file name thanks to svgName];
  
      flex2.tools.Compiler.mxmlc(argscompiler);
      return ThreadLocalToolkit.errorCount();
  }
  </code></pre>
  
  <p>Most of the time, everything works fine.
  But, in some cases, the entire JVM crashes without warning.</p>
  
  <p>I added logs around the mxmlc compiler calling :</p>
  
  <pre><code>try {
      LOG.info("mxmlc compiler calling");
      flex2.tools.Compiler.mxmlc(argscompiler);
      LOG.info("mxmlc compilation finished");
  } catch (final Throwable e) {
      LOG.fatal(e, e);
  }
  </code></pre>
  
  <p>In my logs, it shows me that for lots of files, the compilation works.
  But the JVM crashes, after a "mxmlc compiler calling" line.</p>
  
  <p>So, the issues comes from the flex compiler.</p>
  
  <p>After some tests, I obtained a "JVM Crash report" :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-16"?&gt;
  &lt;WERReportMetadata&gt;
      &lt;OSVersionInformation&gt;
          &lt;WindowsNTVersion&gt;6.1&lt;/WindowsNTVersion&gt;
          &lt;Build&gt;7600 &lt;/Build&gt;
          &lt;Product&gt;(0x30): Windows 7 Professional&lt;/Product&gt;
          &lt;Edition&gt;Professional&lt;/Edition&gt;
          &lt;BuildString&gt;7600.16539.amd64fre.win7_gdr.100226-1909&lt;/BuildString&gt;
          &lt;Revision&gt;1&lt;/Revision&gt;
          &lt;Flavor&gt;Multiprocessor Free&lt;/Flavor&gt;
          &lt;Architecture&gt;X64&lt;/Architecture&gt;
          &lt;LCID&gt;1036&lt;/LCID&gt;
      &lt;/OSVersionInformation&gt;
      &lt;ParentProcessInformation&gt;
          &lt;ParentProcessId&gt;2052&lt;/ParentProcessId&gt;
          &lt;ParentProcessPath&gt;C:\Java\jre6\bin\javaw.exe&lt;/ParentProcessPath&gt;
          &lt;ParentProcessCmdLine&gt;C:\Java\jre6\bin\javaw.exe -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:59809 -Dcatalina.base=C:\Workspaces\Eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 -Dcatalina.home=C:\Tomcat55 -Dwtp.deploy=C:\Workspaces\Eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps -Djava.endorsed.dirs=C:\Tomcat55\common\endorsed -Xms512M -Xmx1024M -XX:MaxPermSize=256m -Dfile.encoding=UTF-8 -classpath C:\Workspaces\Eclipse\[MY PROJECT]\webcontent\WEB-INF\lib\wsdl4j-1.5.1.jar;C:\Tomcat55\bin\bootstrap.jar org.apache.catalina.startup.Bootstrap start&lt;/ParentProcessCmdLine&gt;
      &lt;/ParentProcessInformation&gt;
      &lt;ProblemSignatures&gt;
          &lt;EventType&gt;APPCRASH&lt;/EventType&gt;
          &lt;Parameter0&gt;java.exe&lt;/Parameter0&gt;
          &lt;Parameter1&gt;6.0.200.2&lt;/Parameter1&gt;
          &lt;Parameter2&gt;4bc39549&lt;/Parameter2&gt;
          &lt;Parameter3&gt;dcpr.dll&lt;/Parameter3&gt;
          &lt;Parameter4&gt;6.0.200.2&lt;/Parameter4&gt;
          &lt;Parameter5&gt;4bc3ace7&lt;/Parameter5&gt;
          &lt;Parameter6&gt;c00000fd&lt;/Parameter6&gt;
          &lt;Parameter7&gt;000000000000dacc&lt;/Parameter7&gt;
      &lt;/ProblemSignatures&gt;
      &lt;DynamicSignatures&gt;
          &lt;Parameter1&gt;6.1.7600.2.0.0.256.48&lt;/Parameter1&gt;
          &lt;Parameter2&gt;1036&lt;/Parameter2&gt;
          &lt;Parameter22&gt;dfc4&lt;/Parameter22&gt;
          &lt;Parameter23&gt;dfc49eb22582397c699a9ef43341068a&lt;/Parameter23&gt;
          &lt;Parameter24&gt;7fc1&lt;/Parameter24&gt;
          &lt;Parameter25&gt;7fc14f899de80bb4d59ec0501e30665b&lt;/Parameter25&gt;
      &lt;/DynamicSignatures&gt;
      &lt;SystemInformation&gt;
          &lt;MID&gt;961D9682-D49E-4725-9224-B2748025A619&lt;/MID&gt;
          &lt;SystemManufacturer&gt;Dell Inc.&lt;/SystemManufacturer&gt;
          &lt;SystemProductName&gt;OptiPlex 780&lt;/SystemProductName&gt;
          &lt;BIOSVersion&gt;A03&lt;/BIOSVersion&gt;
      &lt;/SystemInformation&gt;
  &lt;/WERReportMetadata&gt;
  </code></pre>
  
  <p>As you can see, it seems that the dcpr.dll (Sun Java dll) crashes.
  I already had a issue like this one, but it was resolved by going from jdk 1.5 to 1.6.
  It seems that this is not a real solution :s</p>
  
  <p>Info :
  Java version : JDK 1.6.0.20 64 bits
  Flex version : flex_sdk_3.5.0.12683</p>
  
  <p>I do not use the "Full JDK", the one with the [flex]/bin/jvm.config file.</p>
  
  <p>So, here are my questions :
  - can I simply add a jvm.config file (or another one), to set the mxmlc compiler up ?
  - do I have to use a 32 bits jdk ? (it seems that there are issues concerning flex and 64 bits jdk)
  - are there other compiler to convert as to swf ?</p>