i've had it work both ways - just was messing with it trying to find the
problem.

i just printed out the java.class.path system variable from my external
class and got this:

E:\java\1.4.1_01\lib\tools.jar;D:\inet\web-servers\tomcat\4.1\bin\bootstrap.
jar

obviously not what I was expecting...i'm sort of clueless on ClassLoaders so
not sure what to do here - except for changing the java.class.path value ;)



-----Original Message-----
From: Justin Ruthenbeck [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 4:10 PM
To: Tomcat Users List
Subject: RE: Loading properties file for an external class



I've never tried (or seen anyone) using File.separatorChar in this case -- 
not that that definitively means anything :) -- but try using "/" 
instead.  It'll work platform independently because the reference is 
internal to the JVM and doesn't go into the native file system.

Other than that, this should (and does) work.  All I can offer is weak 
encouragement to double check for typos.

justin

At 03:49 PM 11/19/2002, you wrote:
>yep, tried that one too - its sitting there right now ... nothing.
>
>keep in mind that this is not a servlet/JSP that is loading the file (which
>is the only reason I can think of that the file is not being found):
>
>JSP page:
>         <%@ page import="my.pkg.Class" %>
>
>Class source:
>         try {
>             InputStream is =
>this.getClass().getResourceAsStream(File.separatorChar +
"Prop.properties");
>             this.props.load(is);
>         } catch( Throwable t ) {
>         }
>
>
>nothin'.
>
>
>???
>
>
>-----Original Message-----
>From: Paul Campbell [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, November 19, 2002 3:44 PM
>To: Tomcat Users List
>Subject: Re: Loading properties file for an external class
>
>
>I put it in the classes directory.
>eg.
>webapps/YourContext/WEB-INF/classes/some.properties
>
>At 02:56 PM 11/19/02, you wrote:
> >I have a JSP which uses an external class (via an import) and it is
looking
> >for a property file that it loads using the system ClassLoader.
> >
> >I have dropped the properties file just about everywhere I can think of -
> >common/classes, shared/classes, my webapp dir, tomcats bin dir ... every
> >directory I can imagine being on the classpath and then some.
> >
> >Where do I need to drop it?
> >
> >
> >thanks
> >scott
> >
> >--
> >To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to