You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Rutledge, Aaron" <AR...@5prime.com> on 2002/09/06 22:13:37 UTC
trouble creating file object
Hello List,
I am simply trying to browse a file server for a list of filenames with the following JSP snipit below. For some reason, It is returning null for the listfiles() method. I know there are files in the directory and when I run the same piece of code inside of a main() from the server I am returned the list of files using the same JVM. I have tried entering the URI different ways (such as \\\\NTSERVER\\Public\\Intranet, mapping a network drive and then using that, etc.) without luck. Why would Tomcat have trouble with this? I am pretty sure the same piece of code worked fine awhile ago. The only thing I can think of that I've done wierd is add a CATALINA_OPTS variable into catalina.bat so that I could connect to resources outside of our SOCKS firewall (which BTW didn't work). I have removed the variable and I still can't get this going. ANy ideas??? It seems like such a simple obstacle but it is tearing my hair out. Best regards, Aaron
File dir = new File("//NTSERVER/Public/Intranet");
File[] children = dir.listFiles();
if (children == null) {%>
Either dir does not exist or is not a directory
<%} else {
for (int i=0; i<children.length; i++) {
// Get filename of file or directory
if(children[i].isFile()){
String filename = children[i].getName();%>
rest of my code...
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>