Solved

Tomcat Servlet - Find directory of webapp

Posted on 2010-09-22
4
579 Views
Last Modified: 2013-11-24
In a servlet, I'd like to be able to find the web-inf directory of the webapps directory for web app the servlet is in dynamically.

How can I do this?
0
Comment
Question by:modsiw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Author Comment

by:modsiw
ID: 33736936
Aka, on a windows box default install, I'd like to find:

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MyApp\
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 250 total points
ID: 33737388
ServletContext.getRealPath("WEB-INF")

or

Servlet.getServletContext().getRealPath()

or

request.getRealPath(request.getServletPath())

0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 33739621
0
 
LVL 3

Author Closing Comment

by:modsiw
ID: 33873447
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question