public static void main(String[] args) { System.out.println(Thread.currentThread().getContextClassLoader().getResource("")); System.out.println(HibernateMappingManager.class.getClassLoader().getResource("")); System.out.println(ClassLoader.getSystemResource("")); System.out.println(HibernateMappingManager.class.getResource("")); System.out.println(HibernateMappingManager.class.getResource("/")); // Class文件所在路径 System.out.println(new File("/").getAbsolutePath()); System.out.println(System.getProperty("user.dir")); String rootSrc = System.getProperty("user.dir"); String xmlSrc = rootSrc + "//hrJava//config//hbmxml"; System.out.println(xmlSrc); }