System.out.println(LmsFEMain.class .getClassLoader().getResource("" ));
//file:/E:/workspace/FEServer/bin/
System.out.println(ClassLoader.getSystemResource("" ));
//file:/E:/workspace/FEServer/bin/
System.out.println(LmsFEMain.class.getResource("" ));
//file:/E:/workspace/FEServer/bin/org/sklssl/lms/main/
System.out.println(LmsFEMain.class.getResource("/" ));
//file:/E:/workspace/FEServer/bin/
System.out.println(new File("/" ).getAbsolutePath());
//E:\
如果需读取属性文件
一般这样使用:
pro.load(LmsConfiguration.class.getResourceAsStream("/LMS.properties"));
用pro.load(new FileInputStream(fileName));可能读不到文件。原因未知。。。