title: How to create a Java object from JavaScript in Internet Explorer?
body: <p>Let's start with demonstrating the problem with these steps:</p>
  
  <ol>
  <li><p>Open some web page which loads a Java applet in Internet Explorer 9 and a real browser (Firefox or Chrome). Let's use <a href="http://javatester.org/version.html" rel="nofollow">http://javatester.org/version.html</a> for example.</p></li>
  <li><p>Run this code in the JavaScript console:</p>
  
  <pre><code>j = document.applets[0].Packages;
  image = new j.java.awt.image.BufferedImage(256, 256, 2);
  image.getWidth();
  </code></pre></li>
  </ol>
  
  <p>This works in Firefox and Chrome, it outputs the correct image width of 256. But Internet Explorer fails, it displays this error message in the second line:</p>
  
  <pre><code>"java.lang.IllegalArgumentException: No method found matching name java.awt.image.BufferedImage and arguments []" 
  </code></pre>
  
  <p>Any idea why this fails? I was able to instantiate other Java classes which have a default constructor. So this code works correctly:</p>
  
  <pre><code>new j.java.util.Random().nextInt()
  </code></pre>
  
  <p>So maybe Internet Explorer or the Java plugin has a bug passing arguments to a constructor? The error message sounds like IE tries to call the constructor without any arguments (And there is no default constructor in BufferedImage).</p>
  
  <p>I'm interested in any information (maybe existing bug reports) which helps me to understand this problem, fixing it or finding a workaround. Please note that this question is about instantiating java objects from JavaScript, not how to create an image. So please no answers about using Canvas.</p>