This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get path of web application in tomcat?

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the getServletContext().getRealPath("/") method...the you will get the real path till your context.

HTH
MB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic