This is a bug in IKVM's AWT code. It can only handle a BufferedImage for a frame icon.
As indicated in the release notes, AWT is not supported, and after working around this bug I immediately ran into another bug when trying to use the File -> Open menu option (and the app also did not paint correctly).
It would probably be quite a bit of work to get this app working.
> -----Original Message-----
> From: Vito Smolej [mailto:vito.smolej@...]
> Sent: Thursday, February 02, 2012 11:36
> To: ikvm-developers@...
> Subject: [Ikvm-developers] IKVM can not cast sun.awt.image.ToolkitImage
> to java.awt-image.BufferedImage
> Apologies first, if this is the wrong place to ask for help (redirect me
> pls, if this is so).
> I have been looking for possible causes of the problem below quite
> extensively, but the few cases, where "ClassCastException:
> sun.awt.image.ToolkitImage cannot be cast to ..." was mentioned, were
> not helpful insofar code changes have been suggested - and I have an
> inkling, the problem should be simpler to solve.
> I am trying to run ImageJ (http://rsbweb.nih.gov/ij/) using ikvm and I
> get the following exception and post-mortem:
> D:\Data\ikVlll-7.0.4H5.0\bin>ikvm -jar ij.jar
> Exception in thread "main" java.lang.ClassCastException: Das Objekt des
> sun.awt.image.ToolkitImage kann nicht 1n Typ
> umgewandelt werden.
> at cli.system.Windows.Forms.Control.MarshaledInvoke(Unknown Source)
> at cli.system.Windows.Forms.Contro1.Invoke(Unknown Source)
> at cli.System.Windows.Forms.Control.Invoke(Unknown Source)
> at cli.ikvm.awt.NetToolkit.Invoke(Unknown Source)
> at cli.ikvm.awt.NetToolkit.createFrame(Unknown Source)
> at java.awt.Frame.addNotify(Frame.java:477)
> at java.awt.window.pack(Window.java:806)
> at ij.lmageJ.<init>(ImageJ.java:165)
> at ij.ImageJ.main(ImageJ.java:563)
> The IKVM version is as follows:
> IKVM.NET Launcher version 7.0.4335.0
> Copyright (C) 2002-2011 Jeroen Frijters
> CLR version: 2.0.50727.3625 (32 bit)
> mscorlib: 22.214.171.124
> ikvm: 7.0.4335.0
> mscorlib.resources: 126.96.36.199
> yst_: 188.8.131.52
> IKVM.OpenJDK.Core: 7.0.4335.0
> IKVM.Runtime: 7.0.4335.0
> System Configuration: 184.108.40.206
> System.Xml: 220.127.116.11
> OpenJDK version: OpenJDK 7 b147
> OS: windows XP 32bit
> .NET 4 version
> I have an identical problem with another ikvm version (0.46.01) and
> OpenJDK version (OpenJDK 6 b22). I used ikvmc in this environment to
> create ij.dll. It behaves decently in my environment (.net 4, Visual
> Studio 2010, c#) except when it comes to creating the GUI - nothing
> going on. I added IKVM.OpenJDK.SwingAWT assembly to references (to
> silence some "unsatisfied" grumbles;) , on top of IKVM.OpenJDK.Core and
> IKVM.RunTime. Am I missing something evident here?
> Please let me know, what else you would need to know to make any
> Using Eclipse on the Java side and as already mentioned Visual Studio
> and C# on the .NET side.
> Sincere regards
> Vito Smolej (smo)