• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FileReader issues

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having some problems compiling a program. I'm using a FileReader to read in a .txt file and then do some fun extraction on the strings before spitting it out to the screen at the moment.
I keep getting:
Error : Exception java.io.FileNotFoundException must be caught, or it must be declared in the throws clause
of this method.
FindCosts.java line 21 new FileReader(input));
When I try to compile it. I am using CodeWarrior 5 for the Mac if that makes any difference. This is my first time using FileReader so I'm wondering if I did it wrong. The code is below.


[This message has been edited by Cindy Glass (edited December 14, 2001).]
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jax,
Any time you use any I/O method except File you are required to use a try/catch loop:

Regards,
Manfred.
 
Jax Laakso
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!
 
reply
    Bookmark Topic Watch Topic
  • New Topic