Using relative path in java programs - how ?

From: Guy (ni4ni_at_hotmail.com)
Date: 06/15/04


Date: 15 Jun 2004 00:59:00 -0700

Hi

I wrote a new servlet that uses a configuration file to store
parameters.
The problem is that I want to use a relative path when accessing this
file, since I dont know where this servlet will be deployed.
Basically, I want it to be in the same directory where the .class
files are located.

Using the property user.dir does'nt help because it returns the
server's executable path.

How can I control this ? how can the program "know" where the class
files are ?



Relevant Pages

  • Re: Using relative path in java programs - how ?
    ... > I wrote a new servlet that uses a configuration file to store ... > The problem is that I want to use a relative path when accessing this ... since I dont know where this servlet will be deployed. ... and then do a getResource() or getResourceAsStream(sorry I can't ...
    (comp.lang.java.programmer)
  • Servlet file access
    ... I need to access temporary filespace from a servlet. ... store my data in a database, but this is really overkill for the small ... offer database connectivity). ...
    (comp.lang.java.programmer)
  • java.util.logging, where to put logging.properties?
    ... I am doing some coding using java.util.logging, ... if I use a relative path to logging.properties from my current ... configuration file for this application. ... luck with that either: ...
    (comp.lang.java.programmer)
  • Re: pass parameters as the page name rather than as a query string (tomcat)
    ... I tried pageName* as a path but this did not work. ... > Another thought is that i could store the perameters in the path for ... or use the default servlet and redirect everything from there ...
    (comp.lang.java.programmer)
  • Whats the perfect (OS independent) way of storing filepaths ?
    ... I wonder what's the perfect way to store, OS-independent, filepaths? ... use a relative path if drive is identical to the application ...
    (comp.lang.python)