tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ronald G. Louzon" <RGLou...@aethersystems.com>
Subject RE: Servlets and relative paths
Date Wed, 30 May 2001 12:41:12 GMT
I found this in the archives (http://marc.theaimsgroup.com ).  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("myapp.properties"); 
Properties p = new Properties(); 
try 
{ 
   p.load(is); 
} 
catch ( java.io.IOException e ) 
{ 
// Can't load props file 

-----Original Message-----
From: Chris McNeilly [mailto:cmcneilly@smartbrief.com]
Sent: Tuesday, May 29, 2001 11:32 AM
To: tomcat-user@jakarta.apache.org
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.

Thanks,

Chris

Mime
View raw message