@GetMapping("/lujing") public void getLujing() throws Exception{ //当前项目下路径 File file = new File(""); String filePath = file.getCanonicalPath(); System.out.println(filePath); //当前项目下xml文件夹 File file1 = new File(""); String filePath1 = file1.getCanonicalPath()+File.separator+"xml\\"; System.out.println(filePath1); //获取类加载的根路径 File file3 = new File(this.getClass().getResource("/upload").getPath()); System.out.println(file3.getPath()); //获取当前类的所在工程路径 File file4 = new File(this.getClass().getResource("").getPath()); System.out.println(file4); //获取所有的类路径 包括jar包的路径 System.out.println(System.getProperty("java.class.path")); }
各种路径
原创mb60f63d7bf0255 ©著作权
©著作权归作者所有:来自51CTO博客作者mb60f63d7bf0255的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:Maven依赖中scope的含义
下一篇:云接入特别说明
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
C# winform各种路径html javascript d3