Install notes for the ArcGIS API for JavaScript™

#### Installing the ArcGIS API for JavaScript™ Library on Linux

The instructions below assume that you are installing the ArcGIS JavaScript API library in the following location on an Apache Tomcat Web Server, "http://<myserver>:8080/arcgis_js_api/library/2.8/jsapi/" where <myserver> is the domain name of your Web site and '8080' is the default Web server port. This port number, of course, can be changed for your instance if you choose to not use this default port. After copying files to your Web server, you will need to edit some files to include the URL to the server and directory that you are planning to install to.

Please go here for instructions on deploying the library on IIS for Windows.

ArcGIS JSAPI 2.8 contains two builds--a normal build and a compact build. The compact build removes the Dojo Dijit dependancy and minimizes the non-essential ArcGIS JSAPI classes. Please see the documentation for more details.

Your directions may differ depending on your server configuration or Web server, but the process is the same.

1. Copy `\arcgis_js_api\library` and all its contents from the DVD to your Web server. In this example the files are copied to

   `<apache_tomcat_home>/webapps/arcgis_js_api/library`

Configuration options for normal build:

2. Open `<apache_tomcat_home>\webapps\arcgis_js_api\library\2.8\jsapi\js\esri\esri.js` in a text editor.
3. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `"<myserver>:8080/arcgis_js_api/library/2.8/jsapi/"`
4. Open `<apache_tomcat_home>\webapps\arcgis_js_api\library\2.8jsapicompactjs\dojo\dojo\dojo.xd.js` in a text editor.
5. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapi/'`
6. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:/arcgis_js_api/library/2.8/jsapi/'`
7. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:/arcgis_js_api/library/2.8/jsapi/'`
8. Open `<apache_tomcat_home>\webapps\arcgis_js_api\library\2.8jsapicompactjs\dojo\dojo\dojo.xd.js.uncompressed.js` in a text editor.
9. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapi/'`
10. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapi/'`
11. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapi/'`

Configuration options for compact build:

12. Open `<apache_tomcat_home>\webapps\arcgis_js_api\library\2.8\jsapicompact\js\esri\esri.js` in a text editor.
13. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `"<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/"`
14. Open `<apache_tomcat_home>\webapps\arcgis_js_api\library\2.8\jsapicompact\js\dojo\dojo\dojo.xd.js` in a text editor.
15. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/'`
16. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/'`
17. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/'`
18. Open `<apache_tomcat_home>\webapps\arcgis_js_api\library\2.8\jsapicompact\js\dojo\dojo\dojo.xd.js.uncompressed.js` in a text editor.
19. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/'`
20. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/'`
21. Search for the text `'[HOSTNAME_AND_PATH_TO_JSAPI]'`, and replace this text with `'<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/'`
22. Now you shoudl be able to access the ArcGIS JavaScript library from your Web server using the following URL:

    `http://<myserver>:8080/arcgis_js_api/library/2.8/jsapi/` and `http://<myserver>:8080/arcgis_js_api/library/2.8/jsapicompact/`

23. Change the ArcGIS Services Directory "View In JavaScript" URL. Instructions are given in "Configuring the REST API" in the ArcGIS Server REST SDK. On Windows, the location is `<Installation Location>\DeveloperKit\Help\REST\index.html`. On UNIX and Linux, the location is `http://<myserver>:8399/<instance>/sdk/rest/index.html` where `myserver` is your server name and `instance` is the instance name (arcgis is the default).
    - Find the "JavaScript API" section for either .NET or Java for more information about parameter values.
    - For .NET, the parameters to change in `rest.config` are `<ArcGIS>` and `<ArcGISCSS>`. Replace `serverapi.arcgisonline.com` with your server domain name.
    - For Java, the parameters to change in `rest-config.properties` are `jsapi.arcgis` and `jsapi.arcgis.css`. Replace `serverapi.arcgisonline.com` with your server domain name.
24. Test your install. You can use the following test code to validate your JSAPI library install.

#### Test Code

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>Simple Map</title>
        <link rel="stylesheet" type="text/css" href="http://<myserver>:8080/arcgis_js_api/library/2.8/jsapi/js/dojo/dijit/themes/tundra/tundra.css">
        <script type="text/javascript" src="http://<myserver>:8080/arcgis_js_api/library/2.8/jsapi/"></script>
        <script type="text/javascript">
          dojo.require("esri.map");
          function init() {
            var myMap = new esri.Map("mapDiv");
            //note that if you do not have public Internet access then you will need to point this url to your own locally accesible cached service.
            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>
      </head>
      <body class="tundra">
        <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div>
      </body>
    </html>

#### Installing the ArcGIS JavaScript API SDK

The ArcGIS JavaScript API SDK can be copied in its entirety to your Web server directory. This SDK is equivalent to the version found on the ArcGIS Resource Center:

http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=home

1. Copy `\arcgis_js_api\sdk` and all its contents from the DVD to your Web server. In this example the files are copied to

   `<apache_tomcat_home>/webapps/arcgis_js_api/sdk`