I want to create a File object in the class which will be used by servlet There is a directory "xyz" which I want to pass in the constructor of File object. So where I should place the directory. Class file is in C:\Back\tomcat3\webapps\ROOT\WEB-INF\classes\abc\def\LoadDir.class
xyz is just another directory that the file in question is located in? I am not sure how this is relevant. Just make the call to the file in the constructor. If the xyz directory is relative to the context of your application: File file = new File("xyz/MyFile.txt"); Otherwise: File file = new File("C:/mydocs/xyz/MyFile.txt"); No worries....
No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Joined: Nov 21, 2001
Thanks But I think you didn't understand the objective of my question. I want to create the file object in the class running in the tomcat server environment so will I create the file object. Like this
but if I restrict the threads only to their assigned folders(as happend in mycgiserver.com or any other .com server) than I can't create the file object by giving the absolute path. Then I need to create the object something like this
but in this case where should be the in folder xyz so that file object could be created without any exception.but in this case where should be the in folder xyz so that file object could be created without any exception.
Joined: Nov 01, 2002
I would imagine int the root directory is where you'd start. Try this: new File("WEB-INF/classes/abc/def/xyz")