Login  Register

Re: Version Detection?

Posted by Andy Puckett on Oct 08, 2007; 8:12pm
URL: http://imagej.273.s1.nabble.com/Version-Detection-tp3698245p3698246.html

Ok, I find this really annoying.  I'm running the following code:

                String ijvers = IJ.getVersion();
               
                if (ijvers.compareTo("1.38f") < 0) {
                        IJ.log("ImageJ: older");
                        if (imp.getStackSize() < 2 && !(imp instanceof ij.plugin.FITS)) {
                                IJ.error( "Must select a Nova compatible FITS image." );
                                return;
                        }
                } else {
                        IJ.log("ImageJ: newer");
                        if (imp.getStackSize() < 2 && !(imp instanceof  
ij.plugin.FITS_Reader)) {
                                IJ.error( "Must select a Nova compatible FITS image." );
                                return;
                        }
                }

Now, even though I'm running ImageJ 1.38x and the code correctly  
responds with "ImageJ: newer" in the log file (so the ELSE clause is  
being used), I still get this error message:

        /Applications/ImageJ/plugins/Nova20071008/Nova_Plugin_.java:54:
         Class ij.plugin.FITS not found.
                        if (imp.getStackSize() < 2 && !(imp instanceof ij.plugin.FITS)) {

So, Java will still examine (and reject) the code of the THEN clause,  
even though I've told it to use the ELSE clause for versions of  
ImageJ that don't have the FITS class???  That's idiotic.

Ok, bitching aside... any suggestions?

Thanks,
Andy