any way of modify base directory at runtime?

B

Bruno

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
 
S

Simon Brooke

Bruno said:
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.
 
B

Bruno

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:
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top