On Wed, Jan 28, 2015 at 8:48 PM, David kerber <dcker...@verizon.net> wrote:

> On 1/28/2015 2:03 PM, Hyder Hashmi wrote:
>
>> Hi,
>>
>> I am working on a small project and need your help in this.
>>
>> I have a java program in which I read and write in a file that is located
>> in the current folder.
>>
>> Now I have written a few servlets and trying to use the previous code
>> along with servlets.
>>
>> Tomcat is searching for the file in its bin folder and giving
>> FileNotFoundException.
>>
>
> To Tomcat, the /bin folder is it's current directory.


Not quite right, the directory you started from is your current directory.
Which can be TOMCAT_HOME or TOMCAT_HOME/bin etc.

Leon


>
>
>
>> If I use my java code without the servlet it is checking for the file in
>> current folder (which is my requirment).
>>
>
> It looks like you need to refactor your code to allow you to specify where
> to find the file when you call the method that does the work. Then the
> servlet and your pure java code can both specify as needed.  Of course, a
> servlet may not have permissions to anything outside of its own hierarchy,
> but that's a separate issue.
>
>
>
>
>> I want to ensure that when I use my java code along with servlets, it
>> should read and write in the file from current folder(Project folder in
>> tomcat's webapps).
>>
>> I am not using any IDE, the  code is written in Notepad and being
>> executed from CommandLine.
>>
>> I have spent long time on Internet to find the resolution but in vain.
>>
>> Request to help me with this situation .
>>
>> Hoping for a positive reply.
>>
>> Thanks for in advance for all the help.
>>
>> Regards,
>> Hyder.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to