You might want to look at the Class.getResourceAsStream(String resource)
method...creating a resource using a property file format, and sticking it
in with your application classes is not such a bad approach, IMHO.  Might
even be a bit more portable (what happens when you "put away childish
things" and go to BEA or NAS?).  You can then use this stream to load a
property file.  IMHO.

----- Original Message -----
From: Louis <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 18, 2000 2:13 AM
Subject: how to get the current path?


> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0042_01C02150.A9986110
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
>
>
>
>
> Hi,
>    I got a servlet and it will call another class.  In that class I need =
> to read a properties file.  But i don't know where to put my properties =
> file, I try to put anywhere, but still got file not found error.  So =
> what method i can use to know the current path of that
> class will reading?
>
> for example,
> The servlet testDB is in directory
>      WEB-INF /com/iss/npd/servlets
> And the class file dbConnect is in directory
>     WEB-INF/com/iss/npd/database
>
> The dbConnect will  read the database.properties file, anyone can tell =
> me where I can put this file?
>
> In JMC, Servlet Definitions I give this Name=3DtestDB, Class Name =3D =
> com.iss.npd.servlets.testDB
> then in Servlet URL Mappings, I give the Virtual Path/Extension =3D =
> /testDB, Servlet Invoked =3D testDB
>
>
> Thanks
>
>
>
> Louis
>
> ------=_NextPart_000_0042_01C02150.A9986110
> Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; =
> charset=3Diso-8859-1">
> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT face=3DArial size=3D2></FONT><BR></DIV>
> <DIV><BR></DIV>
> <DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; I got a servlet and it =
> will call=20
> another class.&nbsp; In that class I need to read a properties =
> file.&nbsp; But i=20
> don't know where to put my properties file, I try to put anywhere, but =
> still got=20
> file not found error.&nbsp; So what method i can use to know the current =
> path of=20
> that</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>class will reading?</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>for example,</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>The servlet testDB is in =
> directory</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;WEB-INF=20
> /com/iss/npd/servlets</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>And the class file dbConnect is in=20
> directory</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
> WEB-INF/com/iss/npd/database</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>The dbConnect will&nbsp; read the=20
> database.properties file, anyone can tell me where I can put this=20
> file?</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>In JMC, Servlet Definitions I give this =
>
> Name=3DtestDB, Class Name =3D com.iss.npd.servlets.testDB</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>then in Servlet URL Mappings, I give =
> the Virtual=20
> Path/Extension =3D /testDB, Servlet Invoked =3D testDB</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
> <DIV><FONT face=3DArial size=3D2>Louis</FONT></DIV></BODY></HTML>
>
> ------=_NextPart_000_0042_01C02150.A9986110--
>
> --------------------------------------------------------------------------
----
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
> or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
>

------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to