I don't exactly know what you're trying to achieve but this would be my approach:

put the location of your jar file and the base directory into the classpath:
/java/program/;/java/program/cookie.jar

then put cookieprogram.properties into /java/program/

with this setup you can load the property file by calling
bundle = ResourceBundle.getBundle("cookieprogram");
because the ResourceBundle will search the classpath for that bundle

After you do this you can put the path of the files you need to write into the
properties file along with other properties you might need.

d.

Rob Hazlewood wrote:

> Thanks for the resonse,
> The servlet I have made is rather large (200k source - not including templates
> for generating pages)
>
> I've packaged it in a jar, and need it to be able to run just by adding to
> classpath
>
> so any IT staff setting up the system only have to add the classpath, and the
> program needs to determine where it is located (to open, and write to files)
> for several reasons, I am no longer using getResourceAsStream() to open these
> files, so I need to find the full path that they are located in..
> I wanted to set these in an environment variable, but someone decided to
> deprecate the method..
> how should i overcome this problem??
>
> thanks
> Rob
>
> "Christopher K. St. John" <[EMAIL PROTECTED]> wrote:
> > Rob Hazlewood wrote:
> > >
> > > I'm distributing a servlet, and the servlet needs to know where it is
> > > located.
> > >
> >
> >  Why exactly do you want to know? There's probably a
> > work-around, but the solution would depend on what in
> > particular you're trying to accomplish.
> >
> >  Although it won't help you a bit with your problem,
> > it might make you feel better to check out the official
> > java bug list. Some people feel strongly that env variable
> > access should be possible, or barring that, that the
> > documentation should be clarified.
> >
> >
> > > Ideally, I would like it to get it by setting an environment variable
> > > and then for the program to be able to read this.
> > > ... i've noticed that tomcat does it
> > >
> >
> >  Tomcat cheats. The startup scripts do something along
> > the lines of:
> >
> >   $JAVACMD $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME}
> org.apache.tomcat.startup.Tomcat "$@" &
> >
> >  Of course, that's platform specific. You can check this
> > out on your own by looking in the "bin" directory of a
> > tomcat installation, where you will find a maze of twisty
> > little shell/bat scripts, all alike.
> >
> >
> >
> > -cks
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ____________________________________________________________________
> Get free email and a permanent address at http://www.netaddress.com/?N=1
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--
David Mossakowski              [EMAIL PROTECTED]
Programmer                           212.310.7275
Instinet Corporation

"I don't sit idly by, I'm planning a big surprise"

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to