FileNotFoundException(系统找不到指定的路径)

您所在的位置:网站首页 excel系统找不到指定的路径 FileNotFoundException(系统找不到指定的路径)

FileNotFoundException(系统找不到指定的路径)

2024-07-02 09:33| 来源: 网络整理| 查看: 265

今天发现一个问题解决了我非常非常久!!

就是运行tomcat的时候,在访问资源的时候,会报  一个路径  +  系统找不到指定文件

但是你检查发现,这个文件确实就在这里面躺着啊!!!怎么会找不到呢???

解决办法:查看java项目/java文件编码是否为UTF8,

@Test public void test() throws FileNotFoundException { // File file = new File("D:\\Ѹ������\\ADA0 �γ̵���.pptx"); // System.out.println(file.exists()); String path="F:\\xgs\\外包\\aa\\学校教务系统教师课程表.xls"; System.out.println(Arrays.toString(path.getBytes(StandardCharsets.UTF_8))); File file1 = FileUtil.file(path); System.out.println(file1.exists()); ExcelReaderBuilder read = EasyExcel.read(new FileInputStream("F:\\xgs\\外包\\aa\\学校教务系统教师课程表.xls")); List list = read.sheet().headRowNumber(1).doReadSync(); for (Object o : list) { System.out.println(o.toString()); } }

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3