tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ronald G. Louzon" <>
Subject RE: Servlets and relative paths
Date Wed, 30 May 2001 12:41:12 GMT
I found this in the archives ( ).  You might
search them for more info if this doesn't work.  If you put the file in your
servlet's classpath, this code, which in this case is accessing a properties
file, should allow you to access the file. 


InputStream is = this.getClass().getResourceAsStream(""); 
Properties p = new Properties(); 
catch ( e ) 
// Can't load props file 

-----Original Message-----
From: Chris McNeilly []
Sent: Tuesday, May 29, 2001 11:32 AM
Subject: Servlets and relative paths

I've got a servlet and am trying to open files.  The problem is that its
defaulting to the tomcat/bin directory whenever I attempt to refer to
them.  How can I change this?  Hardcoding the path isn't such a good
idea as my dev environment is different from production.  These are xml
and xsl files and they are located on the webroot.



View raw message