tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anto Paul <antop...@gmail.com>
Subject Re: Directory Creation in Servlet Question
Date Fri, 06 May 2005 08:02:36 GMT
On 5/6/05, Joe Hertz <jhertz@speakeasy.net> wrote:
> I have a Struts Servlet that executes the code snippet below to create a
> directory.
> 
> Under Windows, this works great, the directory showing up under
> C:\TOMCAT4\WEBAPPS\
> 
> Under Suze Linux, it doesn't get created, and it's not a permission problem.
> At least not under the webapps directory. The Tomcat user can definitely
> create a directory there (I've su'd to him and done it).
> 
> What should I be looking at next?
> 
> >        String filePath = File.separator + userId;
> >        File dirs = new File(File.separator +
> rs.getMessage("imageFilePath") + filePath);
> >        dirs = new File(File.separator + rs.getMessage("imageFilePath")  +
> filePath);
> >
> >        if (!dirs.exists())
> >        {
> >          dirs.mkdirs();
> >        }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

you tried to debug it. You can check what is the path before the
directory is created. In Linux / means the root directory and since
the path name begins with File.separator(/), the file is created with
reference to /. For eg. if filePath is /anto. Then if Tomcat have
write permission to root directory the directory will be created.

-- 
rgds
Anto Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message