java getimage URL 问题求助 谢谢
各位兄弟,我在调试一个用java getimage 获得网络上JPEG图片的程序,调试通过,只是在运行APPLET 时在IE坐下角出现 小应用程序 notinited 的错误,现向大家
求助 谢谢
java 控制台提示信息:
:java.security.AccessControlException: access denied (java.net.SocketPermission 10.1.1.4 resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin.viewer.context.DefaultPluginAppletContext.getImage(Unknown Source)
at java.applet.Applet.getImage(Unknown Source)
at imag2.init(imag2.java:15)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
import java.applet.*;
import java.net.*;
import java.awt.*;
public class imag2 extends Applet{
Image image;
URL imgur=null;
public void init() {
try {
imgur=new URL( "http://10.1.1.4/qianke.jpg ");
}
catch (MalformedURLException e) {
System.out.println( "Can‘t open the URL ");
}
image=getImage(imgur);
}
public void paint(Graphics g) {
g.drawImage(image, 0, 0,this);
}
}
[解决办法]
up