public String getCurrentWorkingDirectory() {
File f = new File(".");
return f.getAbsolutePath();
//如在eclipse中,显示工程所在路径
}
public String getClassDirectory() {
String cla = this.getClass().getClassLoader().getResource(".").getPath();
return cla;
//显示classes所在路径
}
public String getPackageDirectory(String packagePath ){
packagePath = packagePath.replace('.', '/');
packagePath = classLoader.getResource(packagePath).getPath();
return packagePath;
//返回包路径所在文件路径
}