• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading text file with applet.

 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
This will take every ounce of my mental strength! All for a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic