你把这个文件复制到你的Classpath路径的Config下去。

解决方案 »

  1.   

    是把db.properties 放在WEB-INF\classes\config下吗?
    如果是的话我就这样弄的啊
      

  2.   

    放在classes目录下,与你的类同级
      

  3.   

    谢谢各位我已经搞定了
    我先做了如下改动
    (".\\config\\db.properties");-----------》("db.properties");
    ("./config/db.properties");-------------》("db.properties");
    能用。
    但属性文件的地方不是想要的,后来又做了如下改动:

    FileInputStream is=null;
            try{
                if(System.getProperty("file.separator").equals("/"))
                    is= new FileInputStream("./config/db.properties");
                else
                    is= new FileInputStream(".\\config\\db.properties");
            }catch(FileNotFoundException e){
            System.out.println("File db.properties not found");
            }改为InputStream is = getClass().getResourceAsStream("/config/db.properties");("/config/db.properties");这个路径可以自己设置。
    希望对大家能有帮助。
    谢谢各位的回答。