Quote Path for File

Hi,I want to create a new file in my web application with:File file = new File(Path);How do I have to quote the Path that the file will be saved in my root directory of my web application?thanks in advancekind regardspat
[269 byte] By [patrick270881a] at [2007-10-2 5:16:45]
# 1
nobody knows that?:((
patrick270881a at 2007-7-16 1:19:03 > top of Java-index,Java Essentials,Java Programming...
# 2
you can get the current path that the system, is using by doingFile file = new File(".");String path = file.getCanonicalPath();this will give the root dir
Gorteoa at 2007-7-16 1:19:03 > top of Java-index,Java Essentials,Java Programming...
# 3
Actually new File(".") gives you the current working directory and not the "root" directory. But in any case it doesn't have anything to do with your web application.You (the OP) need to use the getRealPath() method of ServletContext.
DrClapa at 2007-7-16 1:19:03 > top of Java-index,Java Essentials,Java Programming...
# 4
new File(.) doesn't work because it returns the bin directory of the jboss directory on my computer.How can I access the ServletContext? - I work with a JSP-Site....please helpregards
patrick270881a at 2007-7-16 1:19:03 > top of Java-index,Java Essentials,Java Programming...
# 5
Your JSP is still a servlet. And to get the ServletContext in a servlet it'sthis.getConfig().getContext()
DrClapa at 2007-7-16 1:19:03 > top of Java-index,Java Essentials,Java Programming...
# 6

Oh thank you very much, but when I use then the method getRealPath I have to quote a String as paramter for something like a virtual path because the getRealPath method requires a String as parameter.

But I want only to save a file with a specific name in my root directory of my web application....? - without quoting the whole path to the web application directory.

One more help?

regards

patrick270881a at 2007-7-16 1:19:03 > top of Java-index,Java Essentials,Java Programming...