Properties dbProps = null;
dbProps.load(new FileInputStream("/db.properties"));
请确保文件的存在 :)

解决方案 »

  1.   

    你的问题出在db.properties的路径没有指定对。你可以试一下一下代码:
    import java.io.FileInputStream;
    ......try{
      FileInputStream is = new java.io.FileInputStream("db.properties");
      Properties dbProps = new Properties();
      dbProps.load(is);
    } catch (Exception e) {
     ...
    }注意:db.properties 文件要和你的编译好的java class文件在同一个目录。否则
    要注明相对路径或绝对路径。
      

  2.   

    我的经历是在APP SERVER的URL资源中建一个新源,指定PROPERTIES文件的地址,读取时先查找URL资源,再读取文件
      

  3.   

    在那里能找到App server,能讲的具体点吗?
      

  4.   

    你把那个文件放到你的正在使用的那个包中应该没有问题,读取的时候采用
    InputStream is = getClass().getResourceAsStream("db.properties");