1.通过环境变量获取
Map m = System.getenv();
System.out.println(m.get("CATALINA_HOME"));
2.通过打开tomcat的方法获取到的相对路径
System.getProperty("catalina.home")
System.out.println(System.getProperty("user.dir"));
System.out.println(Thread.currentThread().getContextClassLoader().getResource("\\"));