Have a look at "One-jar", it may provide a viable alternative:

http://www-128.ibm.com/developerworks/java/library/j-onejar/
http://one-jar.sourceforge.net/


The deployment is relatively simple, if you follow the suggested methodology.


p



PATTUS, Jean-Philippe wrote:
Probably it's not the best way but it can work :

Take for example a property file that you know is in your webapp
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream is = classLoader.getResourceAsStream("com/.../yourfile.properties");
Create a file from this inputstream and from yis file try the method getPath() 
or getAbsolutePath()....



-----Message d'origine-----
De : asaf.lahav [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 25 janvier 2007 16:04
À : 'Tomcat Users List'
Objet : RE: find where webapp installed via java code


Hi David and thanks for responding,

1. I am using an exploded WAR
2. I want my webapp to contain an additional jars folder (in addition to the
LIB folder) and I would like to know where the webapp is deployed so I'll
know how to calculate the location of the second jars folder.

Let me know if there is any better way to accomplish this.

Thanks in advance,
Asaf




-----Original Message-----
From: David Delbecq [mailto:[EMAIL PROTECTED] Sent: Thursday, January 25, 2007 3:30 PM
To: Tomcat Users List
Subject: Re: find where webapp installed via java code

Please qualify 'system path in which the executing webapp is running'.
do you mean the if your war has been exploded to /tomcat/webapps/myapp/ Then you need to get this path? It can be tricky, because, even if it
were possible by some magic including asking class loader where classes
binaries are located, it could end up being /tomcat/webapps/myapp.war in
case of non exploded war. And why do you want to access this folder? You
can already access read-only all it's content using the classloader's
ressource. And requiring write access is a non sense because this
content will be completely discarded at next deployement.
En l'instant précis du 01/25/07 14:11, asaf.lahav s'exprimait en ces
termes:
Hi all,

I have a servlet in which I need to find the file system path in which the
executing webapp is running.

10x,

Asaf




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


******************************************************************
Ce message et ses pièces jointes sont confidentiels et établis a l'intention 
exclusive de ses destinataires.
Tout message électronique est susceptible d'altération. SOGITEC décline toute 
responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié.
Si vous n'êtes pas destinataire de ce message, merci de le détruire 
immédiatement.
******************************************************************


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to