aspose file tools
The moose likes Tomcat and the fly likes how to get path of web application in tomcat? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "how to get path of web application in tomcat?" Watch "how to get path of web application in tomcat?" New topic
Author

how to get path of web application in tomcat?

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, how do i get the path of web application folder in java ? i want my system auto detect the current running web application folder , how do i code that ?

i have try



which result me "path :c:\web-inf "

how do i make it to get c:\myrunningweb\web-inf ?

note: assume c:\myrunningweb is the current running web folder ..thank you !!
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
You can use the getServletContext().getRealPath("/") method...the you will get the real path till your context.

HTH
MB


Malhar Barai
SOA & Java Book
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to get path of web application in tomcat?
 
Similar Threads
ant javac task not copying directory with no java files
using log4j in Tomcat
opening a File within my WEB-INF folder
Unable to run servlet
Hard to configurate Hibernate using NetBeans 5.5.1