Edwardt
Edwardt

Reputation: 147

Eclipse type var

i have some code examples I am working to implement that uses the type "var". Eclipse doesn't understand this. What am I missing here? Why doesn't Eclipse know what var is?

Code Example:

function initialize() {
    var myLatLng = new google.maps.LatLng(0, -180);

    var myOptions = {
        zoom: 3,
        center: myLatLng,
        mapTypeId: google.maps.MapTypeId.TERRAIN
    };

    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    var flightPlanCoordinates = [
        new google.maps.LatLng(37.772323, -122.214897),
        new google.maps.LatLng(21.291982, -157.821856),
        new google.maps.LatLng(-18.142599, 178.431),
        new google.maps.LatLng(-27.46758, 153.027892)
    ];
    var flightPath = new google.maps.Polyline({
        path: flightPlanCoordinates,
        strokeColor: "#FF0000",
        strokeOpacity: 1.0,
        strokeWeight: 2
    });

    flightPath.setMap(map);
}

Upvotes: 0

Views: 124

Answers (2)

Tejasva Dhyani
Tejasva Dhyani

Reputation: 1362

try to write this code in a .js file or inside the <script type="text/javascript"> tag in a .html or .jsp file

Upvotes: 1

g.d.d.c
g.d.d.c

Reputation: 48028

It would appear that you've retrieved some JavaScript code which you're attempting to put in a Java project. The two are not the same.

Upvotes: 1

Related Questions