0
以下是我的錯誤的一部分。由於這個錯誤,我的applet沒有初始化。以下代碼是init()方法的一部分:Java中的套接字權限錯誤
Socket sock; try { sock = new Socket("localhost", 1307); out = new PrintWriter(sock.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(sock.getInputStream())); } catch (UnknownHostException e) { } catch (IOException e) { }
我米得到以下錯誤:
java.security.AccessControlException: access denied (java.net.SocketPermission 1 127.0.0.1 resolve) at java.security.AccessControlContext.checkPermission(AccessControlConte xt.java:323) at java.security.AccessController.checkPermission(AccessController.java: 546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031) at java.net.InetAddress.getAllByName0(InetAddress.java:1145) at java.net.InetAddress.getAllByName(InetAddress.java:1083) at java.net.InetAddress.getAllByName(InetAddress.java:1019) at java.net.InetAddress.getByName(InetAddress.java:969) at java.net.InetSocketAddress.(InetSocketAddress.java:124) at java.net.Socket.(Socket.java:186) at Alice.init(Alice.java:103) at sun.applet.AppletPanel.run(AppletPanel.java:424) at java.lang.Thread.run(Thread.java:619)
我運行在另一個JVM另一個程序。我正嘗試在本地主機上使用1307端口連接。
感謝您的信息.. :) – user661921 2011-05-06 10:17:47