Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Reading a zip file

 
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 ]
 
(instanceof Sidekick)
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.
 
get schwifty. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic