wood burning stoves 2.0*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
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
 
 
subject: how to get path of web application in tomcat?
 
Similar Threads
opening a File within my WEB-INF folder
Unable to run servlet
ant javac task not copying directory with no java files
using log4j in Tomcat
Hard to configurate Hibernate using NetBeans 5.5.1