Error in program

Vasily Bikov (vas@radio-msu.net)
Sat, 3 Oct 1998 12:55:47 +0300

Hello !
I have a problem with my first program in Java. I have created and
compiled the following code using the Java Development Kit v.1.2 beta
4-k (I downloaded it from your Web-site not too long ago) :

import java.applet.*;
import java.awt.*;
import java.net.*;

public class WebApplet extends Applet {
private Image myImage;
private URL ImageURL;

public void init() {
resize(300,300);
try {
ImageURL=new URL("http://www.mtu.ru/bridge.jpg");
}
catch(MalformedURLException e) {System.out.println("Error in URL"); }
myImage=getImage(ImageURL);
}

public void paint(Graphics g) {
g.drawImage(myImage,20,20,this);
}
}

But this program doesn't want to run. I use Netscape Navigator 4.04 .
He has reported the following errors:

# Security Exception: class from local disk trying to
access url:http://www.mtu.ru/bridge.jpg
# Applet exception: exception: java.lang.NullPointerException
java.lang.NullPointerException

The Appletviewer program has reported:

java.security.AccessControlException:access denide
(java.net.SocketPermission www.mtu.ru resolve)

What's the matter ? I'll be very glad if you explain me the causes of
this problem. Also I want to say that I use Windows95 (not OSR2 !) and
I read in your help-file that the Winsock v.1.1 is not reliable for
this JDK. May be the problem is in my Winsock ?

Thank you.

Developer from Russia,
Vasily