You can get path in controller:
public class MyController extends MultiActionController {
private String realPath;
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
realPath = getServletContext().getRealPath("/");
String classPath = realPath + "WEB-INF/classes/" + MyClass.ServletContextUtil.class.getCanonicalName().replaceAll("\\.", "/") + ".java";
// add any code
}