I was under the impression that applets could read files from their server. I'm getting this exception and the code follows. The applet is on a web page, on server, and is accessed with a browser.
java.security.AccessControlException: access denied (java.io.FilePermission test.xml read) 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.checkRead(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at XMLGraphReader.loadGraph(XMLGraphReader.java:41) at DemoApplet.init(DemoApplet.java:17) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
[ May 06, 2006: Message edited by: S. Stout ] [ May 06, 2006: Message edited by: S. Stout ]
Applets can't use the java.io package for security reasons. But that would anyway be accessing files on the client, while you want to access files on the server (unless the server disk is somehow shared to be accessible by the client, in which case this wiki page describes how java.io can be used). If that's not the case, then this describes how to access files that are on the HTTP server where the applet is hosted.
posted 13 years ago
Thanks. Was able to get it working using URL.
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
create, convert, edit or print DOC and DOCX in Java