Let's start with demonstrating the problem with these steps:
Open some web page which loads a Java applet in Internet Explorer 9 and a real browser (Firefox or Chrome). Let's use http://javatester.org/version.html for example.
Run this code in the JavaScript console:
j = document.applets[0].Packages; image = new j.java.awt.image.BufferedImage(256, 256, 2); image.getWidth();
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:
"java.lang.IllegalArgumentException: No method found matching name java.awt.image.BufferedImage and arguments []"
Any idea why this fails? I was able to instantiate other Java classes which have a default constructor. So this code works correctly:
new j.java.util.Random().nextInt()
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).
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.