• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

AccessControlException question

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

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.
 
S. Stout
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!