Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > any way of modify base directory at runtime?

Reply
Thread Tools

any way of modify base directory at runtime?

 
 
Bruno
Guest
Posts: n/a
 
      10-06-2006
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

 
Reply With Quote
 
 
 
 
Simon Brooke
Guest
Posts: n/a
 
      10-06-2006
in message <(E-Mail Removed) .com>, Bruno
('(E-Mail Removed)') 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.

--
http://www.velocityreviews.com/forums/(E-Mail Removed) (Simon Brooke) http://www.jasmine.org.uk/~simon/

Age equals angst multiplied by the speed of fright squared.
;; the Worlock
 
Reply With Quote
 
 
 
 
Bruno
Guest
Posts: n/a
 
      10-06-2006
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 <(E-Mail Removed) .com>, Bruno
> ('(E-Mail Removed)') 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.
>
> --
> (E-Mail Removed) (Simon Brooke) http://www.jasmine.org.uk/~simon/
>
> Age equals angst multiplied by the speed of fright squared.
> ;; the Worlock


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to detect the absense of virtual destructor in base class? Qi C++ 16 11-26-2011 12:16 PM
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
Any way to programatically modify the URL mappings in the web.config without restarting the asp worker process? justin ASP .Net 1 10-12-2005 04:27 PM
Newbie inheritance question: Any way to go from base to derived? Ex_Ottoyuhr C++ 5 07-22-2004 04:41 PM



Advertisments