看看你的is 是不是 null 先

解决方案 »

  1.   

    完了,编译的时候还说: unreported exception java.io.FileNotFoundException; must be caught or我把db.properties和类文件放在同一个目录下了,
    为什么还是找不倒呢?
      

  2.   

    改来改去总是
    FileInputStream is = new FileInputStream("db.properties");
    这里抛出异常.
    到底是什么原因啊?我把db.properties和类文件放在同一个目录下了,
    为什么还是找不倒呢?
      

  3.   

    老老实实用 full path.
    给你一个:    /**
         * read content from property file
         * @param strFullPath
         * @return
         */
        public  Properties loadProps( String strFullPath )
        {
            Properties props = new Properties();        try
            {
                File fPropFile = new File( strFullPath );
                FileInputStream fis = new FileInputStream( fPropFile );
                props.load( fis );
                fis.close();
            }
            catch(Exception ex){}
            return  props;
        }
      

  4.   

    是不是没捕获异常啊??I/O都要try/catch一下