---
title: "Java中的路径问题"
author: "隐形的翅膀"
date: "2014-12-26T15:51:30Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2014-12-26T15:51:30Z"
id: 2170393
url: "https://ssh-2009-126-com.iteye.com/blog/2170393"
---

1. 得到当前工作路径

String workingDir = System.getProperty("user.dir") 
    			+ "\\src\\main\\webapp\\template\\expor"

2. 得到WEB的根路径

 ServletActionContext.getServletContext().getRealPath("/")+ "template/"