I am having trouble pulling an image from a website. I think that I can use getImage but in the following code, it returns a NULL Pointer Exception.

1)Is this the correct method to use.

2)Any idea as to why I get a NULL Pointer Exception and how would I fix this.


Thanks,

Pedro

import java.applet.Applet; /** DateFormat */
import java.net.URL;

public class A19015url
{

public static void main(String[] args)
{
try
{
String uStr = "http://images.amazon.com/images/P/B0001XANOE.01.THUMBZZZ.jpg";
URL imgURLStr = new URL(uStr);
Applet S = new Applet();
S.getImage(imgURLStr);
}
catch (MalformedURLException errnum)
{
System.out.println(" URL no worky!");
}
catch (IOException errnum)
{
System.out.println("Internet connection is flaky");
}
System.out.println("hiya");
}
}