IDEA入门——jdbc连接和工具类的使用

一切都很顺利,和eclipse差不多,封装工具类用到了:

InputStream in = jdbcUtils.class.getClassLoader().getResourceAsStream("db.properties");
            Properties properties = new Properties();
            properties.load(in);

之后执行的时候报错了空指针,后来查了半天发现是读不出资源文件,原来在我的IDEA中资源文件要放在这个resources文件夹里才能识别:

 

posted on 2021-03-03 00:53  王玉昙  阅读(120)  评论(0编辑  收藏  举报

导航