ZipFile() with URL

I

Ike

I am looking to enumerate all of the file names in a zip file.
If I have a zip file, abc.zip, and it is local, at the root of my classpath,
I can call the following method with :

ArrayList arrayList = new ArrayList();
getAllFiles(arrayList, "/" + "abc.zip);

with an applet, running in appletviewer on the local machine, and the files
within the zip file are enumerated correctly.

However, when I move the applet to a website, (this is a signed applet btw),
and put abc.zip on the website as well, (thus they both reside in the
website specified as CLASSPATH within the html page that calls the applet),
it completely blows up on me (at the line f = new ZipFile(zipFileName);)
with the error message "ava.util.zip.ZipException: The system cannot find
the file specified"

Can someone please tell me how I can call this correctly when I have the zip
file on the web in the classpath? Thank you. -Ike

public void getAllFiles(ArrayList s,URL zipFileURL){
getAllFiles(s, zipFileURL.getFile());
}
public void getAllFiles(ArrayList s, String zipFileName){
ZipFile f=null;
try {
f = new ZipFile(zipFileName);
Enumeration e = f.entries();
while (e.hasMoreElements()){
ZipEntry entry = (ZipEntry) e.nextElement();
s.add(entry.getName());
}
}catch(Exception ex){
ex.printStackTrace();
}finally{
try{
f.close();
}catch(Exception ex2){
ex2.printStackTrace();
}
}
}
 
A

Andrew Thompson

.....
| with an applet, running in appletviewer on the local machine,
and the files
| within the zip file are enumerated correctly.
|
| However, when I move the applet to a website, (this is a signed
applet btw),
| and put abc.zip on the website as well, (thus they both reside
in the
| website specified as CLASSPATH within the html page that calls
the applet),
| it completely blows up on me (at the line f = new
ZipFile(zipFileName);)
| with the error message "ava.util.zip.ZipException: The system
cannot find
| the file specified"

I thought at first it was 'Security' [knee jerk reaction],
but your statments, combined with that message,
indicate not.

Have you tried putting the zip file at the
_codebase_?

What is your actual directory structure
for the applet, html, zip file?

What's your URL?
 
I

Ike

http://ggrip.com
which is also the codebase of the applet, which is also where the file
icons.zip is, and is specified in the archive tag at on the html page, and
also specified in the classpath of the manifest.mf in the applet's jar
file. -Ike
 
A

Andrew Thompson

| http://ggrip.com

That reveals an 'Under Construction' page..

| which is also the codebase of the applet,

There is no mention of an applet on that page.

| ..which is also where the file
| icons.zip is,

Your server is telling a different story..
http://ggrip.com/icons.zip '404'

| ..and is specified in the archive tag at on the html page,

_What_ (friggin') page??

I am trying to help you, I am trying to
get the information necessary for _others_
to help you, but this is like pulling teeth.
 
A

Andrew Thompson

....
| http://ggrip.com/adminleft.html

Aaaah. Now we're cooking with gas.
Noticed one or two strange things on
first inspection.

1) CODE = "GG/GGAdministrator.class"

I would suggest removing GG/ ...
Java can find the class within a given
archive, and it could be stuffing it up.

However, I suspect this is the main prob.
2) The first archive listed is invalid.
As a quick check I rename them to
..zip files and throw them at WinZip.
It reported the archive was not valid..

Have a close look into it, maybe regenerate
it, give it another try. If that, and the change
to the tag do not work, get back to me (..us)

HTH
 
I

Ike

I gave up on it all and just put it all in the same jar as the applet. Got
move on to other things here. THanks anyhow. -Ike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top