• 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

Error setting file paths

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to java and I am trying to load multiple files to read my data input from.
I do not want to hard code the path.
I added my file to my project directory and added following code:
String DATA_INPUT_FILE = "Input1.txt"
BufferedReader input = new BufferedReader(new FileReader(DATA_INPUT_FILE));
But I get the error:
Exception in thread "main" java.io.FileNotFoundException: Input1 (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at com.org.RulesTest.main(Main.java:24) // this is the line where i am passing BufferedReader input = new BufferedReader(new FileReader(DATA_INPUT_FILE));

It workd when I hardcode the pathfile as :"C:\doc\file..."
Can anyone tell me why I am getting this error??Please help.

Thank you
J
 
Jill Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
sorry got it sorted out.
had my files in the wrong place
Thank you
reply
    Bookmark Topic Watch Topic
  • New Topic