chemaxon.marvin.beans.MarvinPane.VERSION

User 9c9bc92f22

03-11-2005 16:04:12

Can somebody run this using the latest Marvin?





System.out.println(chemaxon.marvin.beans.MarvinPane.VERSION);





For some weird reason, mine says 3.2.





I have something that will be using two different versions of marvin and I need to check the version because the older version throws an error when I try to use 'chiral_selected' with toBinFormat();





Thanks,





B

User 9c9bc92f22

03-11-2005 16:30:08

Upon further investigation, it appears that the constant is being "statically linked" at compile time. And since I am using 3.2 to compile, the string "3.2" is being replaced in my compiled code wherever I have chemaxon.marvin.beans.MarvinPane.VERSION. Of course the same thing happens if I use 4.0.1 to compile.





This ain't gonna work 'cause I need to get the version of Marvin being used at run time. Any suggestions?





It would be nice to have a MarvinPane.getVersion().





Thanks,





B

User 9c9bc92f22

03-11-2005 18:13:39

Co-worker got it.





Class c = Class.forName("chemaxon.marvin.beans.MarvinPane");


java.lang.reflect.Field field = c.getField("VERSION");


String version = (String)field.get(null);