You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by William W <wi...@hotmail.com> on 2002/07/16 15:48:52 UTC

Real path question

Hi,
I have a parameter that is a file propertie in my plugIn, the parameter name 
is "myFile" and the parameter value is
"/WEB-INF/classes/myFile.properties". But when I try to read the file, the 
system is looking for it in "c:\WEB-INF\classes\myFile.properties".
How can I get the real path ?

Thanks,
William.





_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Real path question

Posted by Eddie Bush <ed...@vestus.adabbs.com>.
Property files are treated like Java classes (in a sense).  You 
reference them by their "package".  Thus, my best guess is that your 
putting the actual file path in for your parameter value is causing the 
behavior you see.  What you _should_ do (assuming you have it in your 
top-level classes directory) is simply reference it by it's file name: 
"myFile.properties".  Note that you could move it into your applications 
package struction and reference it by it's fully-qualified package name, 
thus:

WEB-INF/classes/com/mycompany/config/myFile.properties would be 
referenced as com.mycompany.config.myFile.properties

... just like you'd reference a class ...

HTH,

Eddie

William W wrote:

> Hi,
> I have a parameter that is a file propertie in my plugIn, the 
> parameter name is "myFile" and the parameter value is
> "/WEB-INF/classes/myFile.properties". But when I try to read the file, 
> the system is looking for it in "c:\WEB-INF\classes\myFile.properties".
> How can I get the real path ?
>
> Thanks,
> William. 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>