Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error setting file paths  RSS feed

 
Jill Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi,
sorry got it sorted out.
had my files in the wrong place
Thank you
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!