File directory = new File("");//参数为空 String courseFile = directory.getCanonicalPath() ; String pa = directory.getAbsolutePath(); System.out.println(courseFile); System.out.println(pa);