Posted by
Wayne Rasband on
Oct 06, 2007; 10:06pm
URL: http://imagej.273.s1.nabble.com/Version-Detection-tp3698245p3698250.html
Use the Class.ForName() method to determine if a given class exits.
This method
boolean exits(String className) {
try {
Class c = Class.forName(className);
return true;
}
catch (ClassNotFoundException e) {}
return false;
}
returns true if the specified class exists. For example, I get
FITS: false
FITS_Reader: true
LSM_Reader: true
in the Log window when I run this code
IJ.log("FITS: "+ exits("ij.plugin.FITS"));
IJ.log("FITS_Reader: "+ exits("ij.plugin.FITS_Reader"));
IJ.log("LSM_Reader: "+ exits("LSM_Reader"));
-wayne
On Oct 6, 2007, at 4:16 PM, Andy Puckett wrote:
> I would also accept a routine that tells me whether a certain class
> is defined or not.
> Specifically, this concerns
> the change as of ImageJ 1.38f from FITS to FITS_Reader/FITS_Writer.
>
> Thanks,
> Andy
>
> ----- Original Message -----
> From: Andy Puckett <
[hidden email]>
> Date: Saturday, October 6, 2007 10:15 am
> Subject: Version Detection?
>
>> Can someone tell me if there is a java routine that will detect
>> which version of ImageJ is
>> being run? I would like to
>> incorporate this into a plugin.
>>
>> Thanks,
>> Andy
>>