Login  Register

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

Posted by Adrian Daerr-2 on Apr 29, 2009; 5:07pm
URL: http://imagej.273.s1.nabble.com/Strange-ClassCastException-A-puzzle-for-Java-ImageJ-experts-to-help-me-wit-tp3692688p3692705.html

> /Applications/ImageJ/plugins/QuickTime_Plugins_MMRD041109/MovieAlignFrameMOD.java:275:
> log(java.lang.String) in ij.IJ cannot be applied to (java.net.URL)
> IJ.log( stack.getClass().getResource("MultiQTVirtualStack.class") );

This just means that getResource gives you a Universal Resource Locator
(URL), whereas IJ.log expects a String. To convert any object to a
String representation, just call its toString() method:

IJ.log(
stack.getClass().getResource("MultiQTVirtualStack.class").toString() );

this is implicit in String concatenations, so the following should also
work:
IJ.log(""+ stack.getClass().getResource("MultiQTVirtualStack.class") );

Otherwise, for you problem at hand, maybe there are several .class files
on your disk/in your jars ?

good luck,
Adrian