tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristján Bjarni Guðmundsson <kris...@hugvit.is>
Subject Re: File Path Problem...
Date Thu, 21 Nov 2002 12:45:31 GMT
I think you could store it in WEB-INF and use 
ServletContext.getRealPath("/WEB-INF").


"Andreas Probst" <andpro77@gmx.net> wrote on 21.11.2002 12:19:51:

> Hello,
> 
> maybe you could save the absolute path inside a properties file 
> or pass it as an init parameter in web.xml. For each location of 
> your app you would have to set this path appropriately. You 
> could use absolute paths and wouldn't need to change the source 
> code of the application.
> 
> Regards,
> Andreas
> 
> 
> On 21 Nov 2002 at 14:31, Harsha Yalagach wrote:
> 
> > Hello,
> > 
> > I am running Tomcat 4.1 on Windows 2000 as a service.
> > 
> >     I have written a JSP page where in I am trying to read an
> >     XML. If I try
> > to access the file using absolute path, for eg. "c:\abc\xyz.xml",
> > the page works without any problem. But if i try to access it
> > thru relative path, for eg. "../data/xyz.xml", the tomcat will
> > throw a FileNotFoundException saying that xyz.xml doesnt exist in
> > SYSTEM-ROOT\System32 dir.
> > 
> >     The reason behind this is that the JSP is tring to access the
> >     file from
> > where JVM was started according to Java Documentation, ie
> > SYSTEM-ROOT\System32 directory where the Service Control Manager
> > starts the Tomcat service which in turn starts the JVM.
> > 
> >     So the question is, is there any other way I can use a
> >     relative path
> > inside my application to access a file? (I dont want to use
> > absolute path as my application has to be distributed in many
> > places).
> > 
> > Thanks in advance...
> > Warm Regards,
> > Harsha Yalagach
> > 
> > 
> > --------------------------------------------------------------
> > Cerebra Integrated Technologies Ltd., Bangalore, India
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail: 
> > <mailto:tomcat-user-unsubscribe@jakarta.apache.org> For
> > additional commands, e-mail:
> > <mailto:tomcat-user-help@jakarta.apache.org>
> > 
> 
> 
> 
> --
> To unsubscribe, e-mail: 
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
<mailto:tomcat-user-help@jakarta.apache.org>
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message