Re: creating a path from the container root

Tom K <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <004e01c34cff$b0f53fe0$6401a8c0@developer>
Kai,

        Thanks!!!

Tom Kochanowicz


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[email protected]] On Behalf Of Kai
Ojansuu
Sent: Friday, July 18, 2003 2:26 AM
To: [email protected]
Subject: Re: creating a path from the container root

java.io.File newDir = new java.io.File(
getServletContext().getRealPath("/"), "newdire" );
newDir.mkdir();

BTW: forward slashes work on Windows too, no need to / => \\

-clapu


>  I am trying to create a directory below the webapps\mywebapp
directory.
>
> I'am able to create directories with the
> java.io.File(new_directory)).mkdirs();  . (or mkdir())
>
> However, I want to create it under the webapps\mywebapp directory,
> To do this I need to get a path to the webapps\mywebapp directory so
> I used request.getContextPath()  which returns the correct path except
> that
> The directory mywebapp comes back with a forward slash (e.g.
/mywebapp)
> When it should be a back slash (e.g. \mywebapp)
>
> I've tried using the java.io.File.separator to make it UNIX/windows
> independent but
> That doesn't work either!
>
> HELP!
>
> TK
>
>

________________________________________________________________________
___
To unsubscribe, send email to [email protected] and include in the
body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.