Eclipse插件开发中获得当前工程目录(二)

2014-11-24 02:38:37 · 作者: · 浏览: 2
is.getClass().getResource("").getPath();

02 packageName = packageName.replace("/", "\\");

03 System.out.println("包名:"+packageName);

04 String projectPath = null;

05 try {

06 String packageFullName = GetPath.getPathFromClass(this.getClass());

07 projectPath = packageFullName.substring(0,

08 packageFullName.indexOf(packageName) + 1);

09 System.out.println("工程路径:"+projectPath);

10 } catch (IOException e1) {

11 projectPath = null;

12 e1.printStackTrace();

13 }

作者“双子座的博客”