Having trouble reading a directory

I'm trying to read all the filenames of a specific web directory for an online photogallery. The reading is done using a custom jsp tag, which creates a js variable with a list of all the picture names. My code works fine when reading from my own PC. For example reading all the names from "C:\Program Files" works perfect. The problem is that I get an error when I try to read from a web directory. Even "http://localhost:8080/test" gives me an error (since I thought it might have something to do with trying to access a directory outside of my domain.) Can anyone help me with the proper way to read a web directory? My code is below:

if(name !=null){

StringTokenizer toker;

File f1 =new File(name);

File[] list = f1.listFiles();//Get all files in the directory "name"

String files ="", fname;

for(int i=0;i<list.length;i++){

fname=list[i].toString();//Turn filename into a string

toker =new StringTokenizer(fname,"\\"); //parse out the path before the filename

while(toker.hasMoreTokens())

fname=toker.nextToken();

files = files +"\"" + fname.substring(0, fname.length()-4) +"\",";//parse out the extension ".jpg"

}

files = files.substring(0,files.length()-1);

pc.getOut().write("><script type=\"text/javascript\"> \n var dirlist = new Array("+files+"); \n </script>");//send the string of filenames to the client

}

[2056 byte] By [ner0a] at [2007-11-27 3:51:36]
# 1
what is the error you get?> Even " http://localhost:8080/test" gives me an error You are not passing that url to the File object are you?
gimbal2a at 2007-7-12 8:55:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I was passing the URL to the file object, which was the problem. But I have no idea how to make this work now, since I don't know of any way to do something like listFiles() with a URL.
ner0a at 2007-7-12 8:55:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...