Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get path of web application in tomcat?  RSS feed

 
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!