JavaScript API Local Install, anyone got this working? if so what version?

3241
8
05-15-2012 07:37 AM
AndrewDavis
New Contributor
I am working through the Install directions for JavaScript API version 2.7.

All of my 2.7 API files are in the wwwroot\arcgis_js_api\library folder.

Looking at the 2.7\jsapi\js\esri\esri.js file you are told to search and replace the "[HOSTNAME_AND_PATH_JSAPI]" with your information:  "http://myserver/arcgis_js_api/library/2.7/jsapi/".

However, there are no mentions of "[HOSTNAME_AND_PATH_JSAPI]" in this particular file.  Nor are there any mentions of this text inside the other files you are to work with.

Has anyone got this working?  If so which version worked for you?


Thanks..
0 Kudos
8 Replies
JeffPace
MVP Alum
I am working through the Install directions for JavaScript API version 2.7.

All of my 2.7 API files are in the wwwroot\arcgis_js_api\library folder.

Looking at the 2.7\jsapi\js\esri\esri.js file you are told to search and replace the "[HOSTNAME_AND_PATH_JSAPI]" with your information:  "http://myserver/arcgis_js_api/library/2.7/jsapi/".

However, there are no mentions of "[HOSTNAME_AND_PATH_JSAPI]" in this particular file.  Nor are there any mentions of this text inside the other files you are to work with.

Has anyone got this working?  If so which version worked for you?


Thanks..


I have run it locally on every version since 1.6 (including currently running 2.8)

there are 6 files to change
esri.js
dojo.xd.js
dojo.xd.js.uncompressed.js
plus the same in the compact folder

in each file there is 1-3 lines that contain

[HOSTNAME_AND_PATH_TO_JSAPI]

for example in esri.js

"[HOSTNAME_AND_PATH_TO_JSAPI]js/esri"

this is where you replace it.
0 Kudos
AndrewDavis
New Contributor
Yes, that is what the documentation says.

In the 1.4 versions the text to replace is there.  I have not been able to find the text to replace in the 2.7 version.

I will look again.  Thank you for your assistance.
0 Kudos
AndrewDavis
New Contributor
Went back this morning, and looked again for the notations inside the 2.7 files:
esri.js
dojo.xd.js
dojo.x.djs.uncompressed.js

There were no places for replacement in two of the files.

I downloaded the 2.8 api/sdk files and have gotten through the textual replaces outlinned in steps 1-22 in the supplied install.htm document.


Inside step 23 of the install doc you are instructed to browse to the following url.
http://<myserver>/arcgis/_js_api/library/2.8/arcgis/ or http://<myserver>/arcgis/_js_api/library/2.8/jsapicompact/

I was never able to get this first link to work as written.. I think there is a typo.
If you try... http://<myserver>/arcgis/_js_api/library/2.8/jsapi/
you will get a page describing the version of dojo you have installed. 

The second link seems to work just fine.

The included Test Code has not worked as of yet.  I have changed the <MyServer> to the appropriate name and am getting two Console errors.
#1) "r is null" in jsapi(line 14)
#2) "uncaught exception: Could not load cross-domain resources: esri.map"

If anyone has any suggestions I would welcome the input.
0 Kudos
JeffPace
MVP Alum
I am sorry you are having so much trouble, but you are mistaken.  Are you sure you are downloading the LIBRARY files.  YOu do not need the sdk, only the library.

for example lines 1034-1036 of the 2.7 library file dojo.xd.uncompressed.js are
dojo.registerModulePath("dojo", (location.protocol === 'file:' ? 'http:' : location.protocol) + '//' + "[HOSTNAME_AND_PATH_TO_JSAPI]js/dojo/dojo");
dojo.registerModulePath("dijit", (location.protocol === 'file:' ? 'http:' : location.protocol) + '//' + "[HOSTNAME_AND_PATH_TO_JSAPI]js/dojo/dijit");
dojo.registerModulePath("dojox", (location.protocol === 'file:' ? 'http:' : location.protocol) + '//' + "[HOSTNAME_AND_PATH_TO_JSAPI]js/dojo/dojox");





Went back this morning, and looked again for the notations inside the 2.7 files:
esri.js
dojo.xd.js
dojo.x.djs.uncompressed.js

There were no places for replacement in two of the files.

I downloaded the 2.8 api/sdk files and have gotten through the textual replaces outlinned in steps 1-22 in the supplied install.htm document.


Inside step 23 of the install doc you are instructed to browse to the following url.
http://<myserver>/arcgis/_js_api/library/2.8/arcgis/ or http://<myserver>/arcgis/_js_api/library/2.8/jsapicompact/

I was never able to get this first link to work as written.. I think there is a typo.
If you try... http://<myserver>/arcgis/_js_api/library/2.8/jsapi/
you will get a page describing the version of dojo you have installed. 

The second link seems to work just fine.

The included Test Code has not worked as of yet.  I have changed the <MyServer> to the appropriate name and am getting two Console errors.
#1) "r is null" in jsapi(line 14)
#2) "uncaught exception: Could not load cross-domain resources: esri.map"

If anyone has any suggestions I would welcome the input.
0 Kudos
JeffPace
MVP Alum
also one installed, you should be able get to

http://<server>/arcgis_js_api/library/2.8/jsapicompact/builddate.txt

for example on my site

http://www.mymanatee.org/arcgis_js_api/library/2.8/arcgiscompact/builddate.txt

note on my site the path is slightly different because I have chosen to continue with the "arcgiscompact" nomenclature of the older versions instead of the renamed "jsapicompact" nomenclature ESRI introduced a few versions ago.
0 Kudos
AndrewDavis
New Contributor
I have gotten the api working now for 2.8.

Just a word for the new folks out there (I'm one of them too as far as server is concerned).  Where you are changing from <MyServer> to the name of your device do NOT include the "http://" on the front end.  It did not like it.

It may have said not to do this in the install, but I do not remember seeing it.



I am working on setting up the SDK for development purposes as well.
0 Kudos
CoreyAlix
Occasional Contributor
Slightly off-topic but will JSAPI 3.0 also have a [HOSTNAME_AND_PATH_TO_JSAPI] or will this become unnecessary?
0 Kudos
TimRourke
New Contributor
Slightly off-topic but will JSAPI 3.0 also have a [HOSTNAME_AND_PATH_TO_JSAPI] or will this become unnecessary?


I vote for "unnecessary". This is the only javascript library or plugin that requires me to edit the script so it knows where it is on disk at runtime.

At the very least can't it just be in one place in one config file instead of several places in six files? 🙂
0 Kudos