Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading file from the Internet

 
Gabriel Soler
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
I have an applet with the following code:
String theFile, thePath, theWorkFile;
theFile = getParameter("myfile");
thePath = getParameter("mypath");
theWorkFile = thePath + theFile;
FileInputStream myStream = new FileInputStream(theWorkFile);
I have no problem when I run this locally. The applet is able to read the file. But when it runs from the Internet it does not work. I get the following error:
java.security.AccessControlException: access denied (java.io.FilePermission http:\www.mysite.com\mydata.txt read)
Read and write are among the file attributes. I have tried many other ways to get this applet to work from my website, but no luck. Can anyone help me with the solution?
Thanks,
Gabriel
 
Chris Stehno
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets may only access web accessable content (unless you jump through some security hoops)... so you should convert your file path into a URL that points to the file you want and then call the openStream() method on the url.
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic