I have the following problem: I cannot get an applet to read from a file, even though it is located in the same directory (the ROOT directory of the Tomcat installed by the J2SDK 1.4.2_04).
It has something to do with Tomcat permissions, because I get the following error: "java.security.AccessControlException: access denied (java.io.FilePermission fileToRead.txt read)".
I tried to edit the "catalina.policy" file in the "%CATALINA_HOME%\conf" directory to set "AllPermission" to the applet's class, I also tried to start Tomcat with "#-security" option as suggested in a post on this forum. Nothing worked.
When I load the page containing the applet from the local filesystem, not through the web-server (at the address "localhost:8080/test.html"), the applet reads the file and outputs it's content just fine (I wrote a simple applet that does nothing but read the file and output it's content in a TextArea, to be able to determine where the problem is, why am I not allowed to read files in my more complex applet). If the file is in a subdirectory, I also get an error about permission to read "user.dir", if I specify the path to the file by a "subdirectory\\file.txt" String.
This must be a trivial issue, but I am only a beginner in terms of web-server usage and web-programming. I mostly wrote applications for my local system. If someone would find the time to reply, I would greatly appreciate the help.
It has something to do with Tomcat permissions, because I get the following error: "java.security.AccessControlException: access denied (java.io.FilePermission fileToRead.txt read)".
I tried to edit the "catalina.policy" file in the "%CATALINA_HOME%\conf" directory to set "AllPermission" to the applet's class, I also tried to start Tomcat with "#-security" option as suggested in a post on this forum. Nothing worked.
When I load the page containing the applet from the local filesystem, not through the web-server (at the address "localhost:8080/test.html"), the applet reads the file and outputs it's content just fine (I wrote a simple applet that does nothing but read the file and output it's content in a TextArea, to be able to determine where the problem is, why am I not allowed to read files in my more complex applet). If the file is in a subdirectory, I also get an error about permission to read "user.dir", if I specify the path to the file by a "subdirectory\\file.txt" String.
This must be a trivial issue, but I am only a beginner in terms of web-server usage and web-programming. I mostly wrote applications for my local system. If someone would find the time to reply, I would greatly appreciate the help.