File f1 = new File(this.getClass().getResource("/").getPath());
System.out.println("获取当前类的所在工程路径"+f1);
File f2 = new File(this.getClass().getResource("").getPath());
System.out.println("获取当前类的绝对路径"+f2);
File directory = new File("");//参数为空
String courseFile = null;
try {
courseFile = directory.getCanonicalPath();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("获取当前类的所在工程路径"+courseFile);
URL xmlpath = new AccountManageController().getClass().getClassLoader().getResource("privateKey");
System.out.println("获取当前工程src目录下privateKey文件的路径 "+xmlpath);
System.out.println("获取当前工程路径 "+System.getProperty("user.dir"));
System.out.println("获取当前工程所有jar包路径 "+System.getProperty("java.class.path"));