1. Download API
United States site: Http://www.esri.com/apps/products/download/index.cfm?fuseaction=download.all#ArcGIS_API_for_JavaScript
China ESRI Website: http://support.esrichina-bj.cn/support/download/software/
2. Installation
After downloading, unzip Library:arcgis_js_v311_api.zip and SDK:arcgis_js_v311_sdk.zip, copy the folder Arcgis_js_api (including library and SDK) to D:\ Program Files\java\apache-tomcat-7.0.55\webapps Directory
3. Configure the normal installation (ArcGIS)
(1) Open the D:\Program files\java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11\init.js file and replace the text with Notepad " [Hostname_and_path_to_jsapi]" To "xjulab:8080/arcgis_js_api/library/3.11/3.11/".
Note:<myserver> can fill in the hostname or host IP address, if you use the private address or deployed on the network, you must fill in the IP address.
(2) Open D:\Program files\java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11\js\dojo\dojo\ Dojo.js file, replace all text with Notepad "[Hostname_and_path_to_jsapi]" as "xjulab:8080/arcgis_js_api/library/3.11/3.11/ ".
4, configure the compressed version of the installation (Arcgis_compact)
Open the D:\Program files\java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11compact\init.js file and replace the text with Notepad " [Hostname_and_path_to_jsapi]"is"xjulab:8080/arcgis_js_api/library/3.11/3.11compact/".
Open D:\Program files\java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11compact\js\dojo\dojo\ Dojo.js file, replace the text with Notepad with "[Hostname_and_path_to_jsapi]" for "xjulab:8080/arcgis_js_api/library/3.11/ 3.11compact/".
5. Test Installation
Http://xjuLab:8080/arcgis_js_api/library/3.11/3.11compact/init.js
Http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/init.js
6, build a test page, run to view the results
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>simple map</title>
<link rel= "stylesheet" type= "Text/css" href= "http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/dijit/themes/ Tundra/tundra.css "/>
<link rel= "stylesheet" type= "Text/css" href= "http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/esri/css/ Esri.css "/>
<script type= "Text/javascript" src= "Http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/init.js" ></ Script>
<script type= "Text/javascript" >
Dojo.require ("Esri.map");
function init () {
var myMap = new Esri. Map ("Mapdiv");
var mytiledmapservicelayer = new Esri.layers.ArcGISTiledMapServiceLayer ("http://server.arcgisonline.com/ArcGIS/ Rest/services/ngs_topo_us_2d/mapserver ");
Mymap.addlayer (Mytiledmapservicelayer);
}
Dojo.addonload (init);
</script>
<body class= "Tundra" >
<div id= "Mapdiv" style= "width:900px; height:600px; border:1px solid #000; " ></div>
</body>
7. Configure "View in JavaScript" on the ArcGIS Services path to use local JS
Open D:\Program files\arcgis\server\framework\runtime\tomcat\webapps\arcgis#rest\web-inf\classes\resources\ Rest-config.properties file, modify the contents as follows:
#JS API URLs
jsapi.arcgis=http://xjulab:8080/arcgis_js_api/library/3.11/3.11/
jsapi.arcgis.sdk=http://xjulab:8080/arcgis_js_sdk/sdk/
Jsapi.arcgis.css=http://xjulab:8080/arcgis_js_api/library/3.11/3.11/js/dojo/dijit/themes/tundra/tundra.css
Note: You can modify the arcgis.com url, reference URL http://resources.arcgis.com/en/help/rest/apiref/index.html?config.html
This article from "It Technology Learning and communication" blog, declined reprint!
ArcGIS JavaScript API 3.11 Localized installation