HelloI've recently taken over development on a project that supports multiple versions of ArcGIS, with different code paths for each version. Previously, the version check was done by the presence of the specific environment variable containing the path to the ArcGIS Desktop install, and the successful loading of the arcobjects.jar. For example, for ArcGIS 10.0:
String arcEngineHome = System.getenv("AGSDESKTOPJAVA"); //Env variable for ArcGIS 10.0
String jarPath = arcEngineHome + "java\\lib\\arcobjects.jar";
File f = new File(jarPath);
// If the jar isn't in the specified path, we can't load the ESRI plugin
if (!f.exists())
return false;
and for ArcGIS 9.3:
String arcEngineHome = System.getenv("ARCGISHOME"); //Env variable for ArcGIS 9.3
String jarPath = arcEngineHome + "java\\lib\\arcobjects.jar";
File f = new File(jarPath);
// If the jar isn't in the specified path, we can't load the ESRI plugin
if (!f.exists())
return false;
While messy, this has worked for us until recently with the release of 10.1. We have run into an issue because both 10.0 and 10.1 both utilize the AGSDESKTOPJAVA environment variable.What would be the best way of checking the version of ArcGIS installed on a user's machine?Thanks!