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
Solved

Tomcat Servlet - Find directory of webapp

Posted on 2010-09-22
4
575 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
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
netstat -ano | find "8000" and taskkill /f /pid 2984 3 83
Should localization be done inside spring controller 5 32
couple of eclipse 5 46
ejb on wildfly 5 30
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video teaches viewers about errors in exception handling.
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.

840 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