Write in front:
In the experiment Java call Arcobject (hereinafter referred to as AO), the development of business functions, encountered ordinary Java engineering can run normally, and in the project to the web background, in Tomcat run, there is an error, the specific error message has been described in other articles, in some not repeat, Development function is indispensable, since there is a problem, it is necessary to solve the problem, then think of the AO program will be developed, packaging can be run independently of the jar package, in a way of CMD call, can not solve the problem, so start testing, do not want to test success, in this record, for future queries.
(Note: Packaged standalone callable AO interface jar package, cannot be run 2 instances at the same time, for specific reasons not to ESRI Technical support consulting, I found it, it is possible to call AO in my code part of the problem, it may be that AO does not support multi-threading, who knows it)
1. Development environment
MyEclipse, ArcGIS 10.5,JDK 1.8 32-bit
Development of the environment of the installation configuration, many online, it is not verbose.
2. Development of AO Code
I want to read this article of the pro already is AO developed Daniel, calf, about Java call AO SDK development, it is not verbose, here, I experiment is AO call Custom Toolbox model, use Geoprocessor and so on content.
3. Specific cmd script
Before writing the Cmd script, assume that the ArcGIS installation path is: C:\Program Files (x86) \arcgis;
The development of good AO program packaged, put in a directory (also can not put, everyone's heart), in this directory to create a new Callao.bat file, write the following content:
REM sets the current CMD window encoding to UTF-8, prevents the development of the AO program from receiving parameters in Chinese and does not run correctly chcp 65001setfiles (x86) \arcgis\desktop10.5setfiles (x86) \java\ jdk1.8. 0_144 Set Path=%java_home%\bin;%agsdesktopjava%bin;%agsdesktopjava%java\Callao. Jar ( This is called AO packaged jar package absolute path) param1 (parameter 1) param2 (parameter 2) //Description: The number of parameters according to the pro call AO code specific circumstances to decide
4. End
Haha, kiss to try, can run up!
Common Java Engineering calls the Arcobject feature, packaged into a standalone runtime program, which is called with a script