This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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
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.