The problem is the "current directory" is the startup directory for tomcat. In a webapp that might be running on several different installations, the current working directory is a moving target.

Given this is always used from an exploded webapp and not a .war file, you could use ServletContext.getRealPath( ). That will return the absolute path to the file, but only if the webapp isn't packed up as .war.

--David

José Roberto Motta Garcia wrote:

Are u trying to access this image from a class or from a JSP? Please
correct me people, but the root path to JSP files is
<TOMCAT_HOME>/webapps/<YOUR_APP_HOME>.

JR

harl3kin wrote:
hello alltogether,

i have a problem with accessing files deployed on tomcat. I want to access
an image which is stored in a "graphics" folder right below the "WEB-INF"
folder. I read that the tomcat-context has its start path on the "classes"
folder. So what i did to retrieve the image was:

Image image = Toolkit.getDefaultToolkit().getImage("/../graphics/toon.gif");

When I debugged I recongnized that the image width and height is -1, so i
figure I didn't load the image correctly. Do you have any suggestions what I
can do to make this work?

I appreciate your time,
Thorsten



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to