---
title: "Tomcat下获取web应用的绝对路径"
author: "bbwang8088"
date: "2017-04-11T10:40:11Z"
tags: []
categories: ["编程语言"]
slug: "tomcat-web"
draft: false
lastmod: "2017-04-11T10:40:11Z"
id: 2368558
url: "https://bbwang8088.iteye.com/blog/2368558"
---

```
String tomcatRoot = request.getSession().getServletContext().getRealPath("/");  
```

 可以获取到"%tomcat\_root%\\%web\_app\_name%\\"的绝对路径