Java 调用 Google Map JavaScript API时,报错提示Exception in thread "JavaFX Application Thread" netscape.javascript.JSException: ReferenceError: Can't find variable: google
在学习Coursera上的一门数据结构课程,将课程提供的源码导入Eclipse,按照提示在google申请了API key,并在index.html中替换,index.html文件如下(除此以外,没有对源码其他地方做任何改动)
<!DOCTYPE html>
<html>
<head>
<title>Simple Map!</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="routing.css" />
</head>
<body>
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=【已替换为新申请的key】&callback=initMap"></script>
<script type="text/javascript" src="visual.js"></script>
</body>
</html>
程序结构如下图所示:
正常的运行效果应该是下面这样:
但实际自己的运行效果显示如下:
控制报错:Exception in thread "JavaFX Application Thread" netscape.javascript.JSException: ReferenceError: Can't find variable: google
请问是哪里的问题