Stick the resource in along with the JAR. Then they will be loaded together and a
simple call to the file without
a path should discover it
-Original Message-
From: Stephan Wiesner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 19, 2001 9:36 AM
To: Tomcat Users List
Subject: How
Why don't you put it in the web.xml
context-param
param-namedirectory/param-name
param-value[my directory]/param-value
/context-param
Then you can grab it from your servlet with a get Context Parameter call.
-Original Message-
From: Stephan Wiesner [mailto:[EMAIL
You have several Options.
Just one: getResourceAsStream().
I think others will provide other solutions.
which is the best, depends on your needs.
-Ursprüngliche Nachricht-
Von: Stephan Wiesner [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 19. Dezember 2001 15:36
An: Tomcat Users
Thanks for all the quick tipps!
Okay, here is what works for me:
InputStream in = this.getClass().getResourceAsStream(1.txt);
int c = 0;
out.println(hr);
while(( c = in.read()) != -1)
out.print(((char)c) + );
out.println(hr);
Stephan
- Original Message -
From: Ralph Einfeldt [EMAIL
- Original Message -
From: Stephan Wiesner [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, December 19, 2001 9:36 AM
Subject: How to find a file from a class with Tomcat
I have a Servlet S.java which uses a class C.java (not a servlet itself,
could make it