确定相对路径

Determining the relative path

我有这个工作的绝对路径

String path = "C:/projects/ISI7/Releases/Release_15.2/EXT_JS/src/main/webapp/WEB-
INF/classes/commonComponents/ApplicationResources_"+ language + ".properties";

我想获取相对路径。我以为相对路径是:

String path = "classes/commonComponents/ApplicationResources_"+ language + ".properties";

但我得到 fileNotFound 异常

我试过的是:

String path = "commonComponents/ApplicationResources_"+ language + ".properties"; 

也没有用。使用 JDK 1.6 和 Windows OS.

要确定您的工作目录,试试这个:

File f = new File(".");
System.out.println(f.getAbsolutePath());