// Get the ArcGIS Engine runtime, if it is available
String arcObjectsHome = "E:\\Program Files\\ArcGIS\\Desktop10.0\\"
// If no runtime is available, exit application gracefully
if (arcObjectsHome == null) {
System.err
.println("You must have the ArcGIS Engine Runtime installed in order to execute this application.")
System.err
.println("Install the product above, then re-run this application.")
System.err.println("Exiting execution of this application...")
System.exit(-1)
}
// Obtain the relative path to the arcobjects.jar file
String jarPath = arcObjectsHome + "java" + File.separator + "lib"
+ File.separator + "arcobjects.jar"
// Create a new file
File jarFile = new File(jarPath)
// Test for file existence
if (!jarFile.exists()) {
System.err
.println("The arcobjects.jar was not found in the following location: "
+ jarFile.getParent())
System.err
.println("Verify that arcobjects.jar can be located in the specified folder.")
System.err
.println("If not present, try uninstalling your ArcGIS software and reinstalling it.")
System.err.println("Exiting execution of this application...")
System.exit(-1)
}
// Helps load classes and resources from a search path of URLs
URLClassLoader sysloader = (URLClassLoader) ClassLoader
.getSystemClassLoader()
Class<URLClassLoader> sysclass = URLClassLoader.class
try {
Method method = sysclass.getDeclaredMethod("addURL",
new Class[] { URL.class })
method.setAccessible(true)
method.invoke(sysloader, new Object[] { jarFile.toURI().toURL() })
} catch (Throwable throwable) {
throwable.printStackTrace()
System.err
.println("Could not add arcobjects.jar to system classloader")
System.err.println("Exiting execution of this application...")
System.exit(-1)
}
}
如果是arcgis9.3,则应该对应的使用vs2008,在安装arcgis9.3时,会自动将arcgis工具箱控件添加到vs2008中,在2008中新建项目asp.net web 应用程序,然后将arcgis工具箱中所需的控件直接拖到项目的default.aspx中,配置控件的属性,这是最简单的,如果要求跟复杂的,需要深入的学习了欢迎分享,转载请注明来源:内存溢出
评论列表(0条)