View Single Post
  #1 (permalink)  
Old 07-31-2007, 03:32 PM
Gnanam Gnanam is offline
Member
 
Join Date: Jul 2007
Posts: 3
Gnanam is on a distinguished road
to find the workspace path at runtime to write the file
Hi All,
this is my first post in this forum..
I have a Struts project deployed in tomcat webapps. User Sign in details are configured in a xml file and are validated by reading the xml file..The xml file is in the path WEB-INF/classes/com/files/user.xml...
when a new user has to be added his/her details has to be written in the same user.xml file..I read the the file using
getClass().getClassLoader().getResourceAsStream("c om/files/user.xml");

To write the file using filewriter if I have to give the full path without hardcoding it.
For eg.
D:/SDE3.0/workspace/project/WebContent/WEB-INF/classes/com/files/user.xml
when I tried to get this path URL using getClass().getClassLoader().getResource("com/files/user.xml") , i get
C:/Program Files/SDE3.0/tomcat-5.5.16/webapps/Request/WEB-INF/classes/com/files/user.xml

Please suggest me how to solve this issue or is there way to find the workspace path at runtime so that I can avoid hardcoding of this path.
Thanks in advance
Regards,
Gnanam
Reply With Quote
Sponsored Links