由于最近JDK在线包被墙了,无奈进行了本地部署。
本地部署的步骤,在jdk包里面的install.html里面都有,直接用google浏览器翻译一下就可以看。
主要的步骤如下:
用“正常构建的配置选项”即可。
这里要注意几个问题,就是说在原来的版本中,传输协议是http,而现在的版本是https。
也就是说,如果你的localhost站点没有证书的话,调用jdk是会报错“ERR_SSL_PROTOCOL_ERROR“。
这个时候只要把上边配置中的https改为http,并且在引用时,也是引用http而不要引用https即可。
下面附上测试代码
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Test Map</title>
<link rel="stylesheet" href="http://www.example.com/arcgis_js_api/library/3.24/3.24/esri/css/esri.css" />//注意是http,然后改成自己的主机名
<script src="http://www.example.com/arcgis_js_api/library/3.24/3.24/init.js"></script>
<style>
html,
body,
#map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<script>
require([
"esri/map",
"esri/layers/ArcGISTiledMapServiceLayer",
"dojo/domReady!"
],function(Map, ArcGISTiledMapServiceLayer) {
var map = new Map("map");
//If you do not have Internet access then you will need to point this url to your own locally accessible tiled service.
var tiled = new ArcGISTiledMapServiceLayer("https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer");
map.addLayer(tiled);
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>