any way of modify base directory at runtime?

Discussion in 'Java' started by Bruno, Oct 6, 2006.

  1. Bruno

    Bruno Guest

    Hello all,

    Well, I'm using tomcat to run my web application, which loads
    dinamically many jars and execute them. My problem is that these jars
    sometimes have a method that uses relative paths to do something (read
    files, create files, etc). Currently, the current base dir is given
    wrong for these loaded applications! Instead of the right path, it's
    given "C:\tomcat" or something.

    If it were with my Web Application itself, it would be easy to get over
    this problem by using the getRealPath("") method provided by api. But
    since I can't modify the jar code I will load, what can I do? Some
    ideas?

    Thanks you!

    Bruno
     
    Bruno, Oct 6, 2006
    #1
    1. Advertising

  2. Bruno

    Simon Brooke Guest

    in message <>, Bruno
    ('') wrote:

    > Hello all,
    >
    > Well, I'm using tomcat to run my web application, which loads
    > dinamically many jars and execute them. My problem is that these jars
    > sometimes have a method that uses relative paths to do something (read
    > files, create files, etc). Currently, the current base dir is given
    > wrong for these loaded applications! Instead of the right path, it's
    > given "C:\tomcat" or something.


    The path should be relative to the webapp directory of the particular
    webapp.

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    Age equals angst multiplied by the speed of fright squared.
    ;; the Worlock
     
    Simon Brooke, Oct 6, 2006
    #2
    1. Advertising

  3. Bruno

    Bruno Guest

    Thank you for answer.

    Well, I can't modify the path the jar classes is using.
    Let me show an example: if the class is trying to read the file
    "./file.xml" which is in its current directory, it will not find it.
    Instead, it will be accesing C:\tomcat/file.xml that doesnt exists.
    Since I cant change the method that reads this file, Id like to change
    externally in some way the base path that is considered for this loaded
    jar. Maybe I missed it up a bit, but I think it's clearer now.


    Simon Brooke escreveu:

    > in message <>, Bruno
    > ('') wrote:
    >
    > > Hello all,
    > >
    > > Well, I'm using tomcat to run my web application, which loads
    > > dinamically many jars and execute them. My problem is that these jars
    > > sometimes have a method that uses relative paths to do something (read
    > > files, create files, etc). Currently, the current base dir is given
    > > wrong for these loaded applications! Instead of the right path, it's
    > > given "C:\tomcat" or something.

    >
    > The path should be relative to the webapp directory of the particular
    > webapp.
    >
    > --
    > (Simon Brooke) http://www.jasmine.org.uk/~simon/
    >
    > Age equals angst multiplied by the speed of fright squared.
    > ;; the Worlock
     
    Bruno, Oct 6, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. justin
    Replies:
    1
    Views:
    608
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Oct 12, 2005
  2. Ex_Ottoyuhr
    Replies:
    5
    Views:
    547
    Ex_Ottoyuhr
    Jul 22, 2004
  3. Protoman
    Replies:
    28
    Views:
    782
    Protoman
    Jul 5, 2007
  4. chandan
    Replies:
    3
    Views:
    470
    PJ on Development
    Dec 6, 2007
  5. Qi
    Replies:
    16
    Views:
    924
    Juha Nieminen
    Nov 26, 2011
Loading...

Share This Page