日期:2014-05-20  浏览次数:20757 次

这个异常吗??帮忙看看先
while(first_file.exists())
  {
    RandomAccessFile   first_filef=new   RandomAccessFile(first_file, "r ");
    while((a=first_filef.read(bueff))!=-1)
    {    
      filedd.write(bueff,0,a);
    }
    first_filef.close();
    qkl++;
    first_file=new   File(file_direction,right2_name+Integer.toString(qkl));
  }
    filedd.close();
  }
 
  catch(FileNotFoundException   ee1)
  {
      JOptionPane.showMessageDialog(null, "第 "   +   qkl   +   "个文件不存在 ", "提示 ",2);
    }
  catch(IOException   ee2)
  {
  JOptionPane.showMessageDialog(null, "第 "   +   qkl   +   "个文件不存在 ", "提示 ",2);
    }


我这里存在文件是只有xxx1,xxx2,按理解,
当我File(../xxx3)的时候,因为文件不存在应该回提示   catch(FileNotFoundException   ee1)里的语句,RandomAccessFile   first_filef=new   RandomAccessFile(first_file, "r ");也该会执行catch(IOException   ee2)里的语句,为什么没有执行呢,这里没有异常吗???


------解决方案--------------------
为什么不Debug看看程序如何走的呢?这样不就知道为什么了么?
可能是 first_file.exists() 已经判断了文件是否存在的缘故!!!!
------解决方案--------------------
你的条件while(first_file.exists()),当然不会有异常