tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myat...@potsdam.edu
Subject Re: listFiles() 500 errors
Date Mon, 11 Feb 2002 19:41:04 GMT
Mark,

The best way I found to use listFles is like so:

File myfile = new File("/uploaddir/");
File file[] = myfile.listFiles();

This way you don't have to set an initial size to the file[] in case the #
of files in the directory exceed the size of the array. Don't know if this
solves your problem, but I hope it helps.

 - Adam


At 11:10 AM 2/11/2002 -0800, you wrote:
>
>Hi, 
>
>We have tomcat installed and everything looks to 
>be OK (all of the examples work fine, and all of 
>our pages compile fine), except for one page which
>makes a call to listFiles().
>
>Here is the code snippet:
>
>[...]
>
> String ch = String.valueOf(request.getQueryString());
> try{
> File myfile = new File("/uploadedir/");
> File file[] = new File[200];
> file = myfile.listFiles();
> String str = "";
> if(ch.equals("all"))
>
>[...]
>
>And here is the error message:
>
>Error: 500
>Location: /servlets/alphaOrder.jsp
>Internal Servlet Error:
>
>org.apache.jasper.JasperException: Unable to compile 
>Found 1 semantic error compiling
"/var/cache/tomcat/DEFAULT/ROOT/servlets/alphaOrder_1.java":
>
>   116.                     file = myfile.listFiles();
>                                       <---------------->
>*** Error: No method named "listFiles" was found in type "java/io/File".
>
>at org.apache.tomcat.facade.JasperLiaison.javac(Unknown Source)
>at org.apache.tomcat.facade.JasperLiaison.processJspFile(Unknown Source)
>at org.apache.tomcat.facade.JspInterceptor.requestMap(Unknown Source)
>at org.apache.tomcat.core.ContextManager.processRequest(Unknown Source)
>at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
>at org.apache.tomcat.core.ContextManager.service(Unknown Source)
>at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown
 Source)
>at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
>at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
Source)
>at java.lang.Thread.run(Thread.java)
>
>
>... we're stumped because everything else is working fine,
>and if we comment out just that one line, it will work without
>the error message (but without listing the files, ofcourse).
>
>The server is debian woody running a standard install, up
>to date as of a few minutes ago.
>
>TIA,
>
>-- 
>Mark
>
>
>
>--
>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>
>
>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message