您的位置:首页 > 编程语言 > Java开发

【java】获取eclipse的安装路径以及工程名称

2017-05-10 10:38 489 查看
String eclipseRootPath = System.getProperty("user.dir");
String rootPath = eclipseRootPath.substring(0, eclipseRootPath.lastIndexOf("\\"));
URL realPath = this.getClass().getResource("/");
String projectName = realPath.getPath().substring(realPath.getPath().indexOf("webapps")+8, realPath.getPath().indexOf("WEB-INF")-1);

String saveBasePath = rootPath + "\\" + projectName +"Config";
System.out.println(saveBasePath);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息