how to find the location of the dynamic tmp folder created by JBOSS
john alexa
Greenhorn
Joined: Nov 15, 2011
Posts: 2
posted
0
hey everyone,
I have a unique situation and was wondering if anyone knows if this can even be done and/or and ideas on the topic I may try:
I am runing my web application through a JBOSS server. Upon startup it builds the WAR file and sends it to my jboss-5.1.0.GA\server\default\tmp folder.
my application builds an xml file that i then have to save to the same folder as my WAR file, but the problem is that every time I start my run my app it generates a random folder within the /tmp folder.
In order for me to send my xml to the folder i would have to locate the path of my WAR file from within the application, or i would have to know name of the folder within the /tmp folder that is being dynamically created for the session.
I know this is explained in the worst way so i will try to show you what i mean:
when i run my application the first time it builds my WAR file in this folder:
jboss-5.1.0.GA\server\default\tmp\4e3f35f-87gz9k-guzu43hg-1-guzu98hv-9u
then i close my eclipse out, reopen it and run it again, and this time it saves here:
jboss-5.1.0.GA\server\default\tmp\4e3f35f-87gz9k-guzu43hg-1-guzua866-9v
it generates the random "4e3f35f..." folder with a new name each run, and in order for me to send my xml file there i need to be able to find that folder name and place it within a String from within the running application. If anyone knows how this can be done or has any ideas i am open to tryin anything.
Thanks a lot,
John
john alexa
Greenhorn
Joined: Nov 15, 2011
Posts: 2
posted
0
nevermind i figured it out!
i had originally been told this no longer worked in the version of eclipse i was using, however I tried it out of pure spite and it worked perfectly. its actually very easy.
simply place the following line in any of your Servlets or JSP pages:
getServletContext().getRealPath("/")
subject: how to find the location of the dynamic tmp folder created by JBOSS