Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading text file with applet.  RSS feed

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have jar file of my applet on a server..
In same directory I have the folder PGN_FILES, which contains
the file DEEPBLUE.txt

I'm trying to read the contents of the file with:

But I get the following the error:
access denied (java.io.FilePermission \PGN_FILES\DEEPBLUE.txt read)

I've tried using "PGN_FILES/DEEPBLUE.txt" too, but that doesn't work.

Perhaps if applet is signed it will work, but its too tricky to get
to work, and I'm sure I've read from a text file on server before
without using a signed applet.

Can anyone fix this?
Thanks for any help.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An applet needs to be signed in order to do any file I/O.

Since you mention reading from a file on the server: That will work without signing the applet, but not if you use file I/O. You'll need to use the java.net.URL or URLConnection class, or -alternatively- use the resource loading mechanism of the classloader.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I've found a good website with a nice solution.

http://forums.devarticles.com/java-development-38/applet-file-access-on-server-102952.html

I tried it, it works great!
[ September 07, 2007: Message edited by: colin shuker ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!