Tag: japplet illegalargumentexception

jre8中URLPermission处的IllegalArgumentException

当我运行下面的代码时, – 在JRE8上的一个Applet中,在con.getInputStream()行上它抛出exception – 在JRE7或JRE6上的Applet中它不会抛出。 – 在任何JRE上的桌面应用程序中它不会抛出。 当我删除行以setRequestPropery开头时,它不会在任何JRE上抛出exception。 URLConnection con = new URL(adress).openConnection(); con.setDoOutput(true); con.setDoInput(true); con.setUseCaches(false); con.setRequestProperty(“Content-Type”, “application/octet-stream”); con.setRequestProperty(“pragma:”, “no-cache”); PrintStream ps = new PrintStream(con.getOutputStream()); ps.println(“Test”); ps.close(); in = new DataInputStream(conn.getInputStream()); 例外: java.lang.IllegalArgumentException: invalid actions string at java.net.URLPermission.init(Unknown Source) at java.net.URLPermission.(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.URLtoSocketPermission(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source) 在我的applet中,我试图打开一个连接,我需要这些请求属性。 你知道JRE8上导致这个exception的原因吗? 为什么只在applet而不是desktopapp。