web项目在C盘怎么读取D盘下的.properties数据库路径,作业要求大神求指点啊

InputStream inputStream = DBconn.class.getClassLoader().getResourceAsStream("/util/jdbc.properties");
怎么读取D盘下的.properties文件

File file= new File("D://xxxxxxxxxx");
InputStream in = new InputStream(new FileInputStream(file));
这里面的File你取D盘的绝对路径就行了

InputStream inputStream = DBconn.class.getClassLoader().getResourceAsStream("/util/jdbc.properties");

我建议你将.properties文件放到web项目下面。否则web项目打包后是无法使用的

直接读取配置文件就好了