Re: Strange ClassCastException: A puzzle for Java/ImageJ experts to help me wit?.

Posted by dscho on
URL: http://imagej.273.s1.nabble.com/Strange-ClassCastException-A-puzzle-for-Java-ImageJ-experts-to-help-me-wit-tp3692688p3692702.html

Hi,

On Wed, 29 Apr 2009, Bill Mohler wrote:

> IJ.log(""+stack.getClass().getName() + "2");
>
> /** THIS DOES NOT REPORT, SO IT'S CLEAR THAT stack IS
> NOT reporting as instanceof MultiQTVirtualStack,
> even though it reports as one using
> stack.getClass().getName() **/
> if (stack instanceof
> MultiQTVirtualStack ) IJ.log("MultiQTVirtualStack? Yes!!!!");
>
> /*** ...But THIS STILL READS OUT AS
> MultiQTVirtualStack  ******/
>
> IJ.log(""+stack.getClass().getName() + "3");

Just a hunch, could you compare

stack.getClass().getResource("MultiQTVirtualStack.class")

to

Class.forName("MultiQTVirtualStack").getResource("MultiQTVirtualStack.class")?

(Maybe even MultiQTVirtualStack.class.getResource(...))

I _could_ imagine that there is a class loader problem...

Ciao,
Dscho