Re: FileInputStream in Servlet



bauerg@xxxxxxx wrote:
I have a servlet, which I want to debug within eclipse.
The servlet is reading a config-file on startup, this file is opend
with a FileInputStream(filename), but without a path!

I have defined the Tomcat4 for MyEclipse with different HOME and BASE,
if I set a fix path (i.e. "c:/file.ext") then everythin works fine, but

without the path, the FileInputStream everytime gives a exception:
java.io.FileNotFoundException: file.ext

I have placed the file.ext in many directories, but it never has been
found!

Where to hell does Tomcat search for this file???

Please could someone help me? Do I have to place the file in
TOMCAT_HOME, TOMCAT_BASE, somwhere under one of this, or what?

As I recall, Tomcat provides working space on a per-webapp basis somewhere under its own directory hierarchy. I believe the location can be configured, in fact. You'll find it in the docs if you read long enough.


But why not make Tomcat tell you instead? Just have a servlet or JSP (running in your debug environment) send the value of the System's "user.dir" property; this should name the directory you want.

--
John Bollinger
jobollin@xxxxxxxxxxx
.



Relevant Pages