Trouble loading a PNG image from a URL
<p>Not sure what I'm doing wrong here.  The try/Catch exception is printed when I run.  </p>

<pre><code>public class GoogleMap {
    Image mapImage;
    GoogleMap(Marker...markers) {
        // Create an integer variable to store the image scale
        int mapScale = 1;

        // Create variables to store latitude and longitude values
        double latitude = 40.7304115;
        double longitude = -73.59138;
        // create a string variable to store the URL
        String myURL = "http://maps.googleapis.com/maps/api/staticmap?center=40.730478," +
            "-73.591257&amp;zoom=17&amp;size=512x512&amp;maptype=satellite";
        String endURL = "&amp;sensor=false&amp;scale=1";
        // create a loop to concatenate the array of markers
        for (int i=0; i &lt; markers.length; i++)
            myURL += markers.toString();

        // create a try catch block to read the data from Google
        try {
            URL url = new URL(myURL);
            BufferedImage bi = ImageIO.read(url);
            File fileOut = new File("myMap.png");
            ImageIO.write(bi, "png", fileOut);
        } 
        catch (IOException e) {
            System.out.println("That didnt work.");         
        }

        // try catch block to read the file created above and store in the variable mapImage
        try {
            mapImage = ImageIO.read(new File("myMap.png"));
        }
        catch (IOException ie) {
            System.out.println("That didn't work either");
        }
    }

    public Image getMap() {
        return mapImage;
    }
}
</code></pre>
