This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a zip file

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to be able to read the contents of a .zip file placed on a server from within an applet.

Currently the code below...

Reads the contents of somezip.zip (code and zip file on desktop) and adds it to the 'text' String.
But when I try it from applet(both on server), I get
'access denied (java.io.FilePermission somezip.zip read)'

Is there any way to fix this, without using signed jars, or policy files.

Thanks for any help.
[ May 08, 2007: Message edited by: colin shuker ]
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you have is trying to read from local disk on the browser user's PC. That is forbidden for applets unless you set up the security policy file. But that isn't really what you want to do, is it?

To get files off the server you'll have to use HTTP. Your applet can use an HttpUrlConnection to GET a file from the server. I'd expect the server to extract one file from a zip and return it to the applet. Does that sound right to you?
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for fast reply, I still have no idea how to do that though.
I guess you are right though, the applet is searching on the pc for the file.

But when the applet has to load images on the server to use, it uses a class loader..

I'm not sure if that would come into it, when trying to load a zip.

Thanks for any advice.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!