• 2024-09-16JAVA-IO获取resource WEB-INF 中文件 JAR包中
    getResource+getPath()classPaththis.getClass().getClassLoader().getResource(StringUtils.EMPTY).getPath()Stringpath=this.getClass().getClassLoader().getResource(fileName).getPath();StringfilePath=URLDecoder.decode(path,StandardCharsets.UTF_8);
  • 2024-07-29观光之旅
    //观光之旅.cpp:此文件包含"main"函数。程序执行将在此处开始并结束。///**https://www.acwing.com/problem/content/description/346/**给定一张无向图,求图中一个至少包含3个点的环,环上的节点不重复,并且环上的边的长度之和最小。该问题称为无向图的最小环问题
  • 2024-06-01SpringBoot 中获取项目的路径和文件流
    SSMweb项目以工程名为TEST为例:(1)得到包含工程名的当前页面全路径:request.getRequestURI()结果:/TEST/test.jsp(2)得到工程名:request.getContextPath()结果:/TEST(3)得到当前页面所在目录下全名称:request.getServletPath()结果:如果页面在jsp目录下/TEST/jsp/test.jsp
  • 2023-01-09getPath()与getAbsolutePath()的区别
    publicstaticvoidmain(String[]args){Filefile=newFile("\\data\\draw_lottery\\test1.txt");//取得相对路径System.out.println("P
  • 2022-12-28Spring boot 的路径踩坑
     代码@ApiOperation(value="测试")@PostMapping("/GetFileSystem")publicList<String>getFileSystem(HttpServletRequestrequest){List<S
  • 2022-11-15打包后this.getResource(“”).getPath()获取不到对应的文件解决方法
    使用this.getClassLoader().getResource(“”).getPath();Java 在开发中经常需要获取资源文件路径,读写配置文件:this.getClass().getClassLoader().getResource(“路径”