I am trying to use TextIO.readFile to read a .dat file in NetBeans. I have places the .dat file in the source folder of the project, as well as TextIO.java.
This is the command i am writing at the start of the program:
package conecount;
public class Main {
public static void main(String[] args) {
int coneCount; //variable to count total cones
String flavor; //variable to hold flavor of line read
int berryCount; //variable to count strawberry cones
coneCount = 0; //set total count to 0
berryCount = 0; //set strawberry count to 0
TextIO.readFile("icecream.dat"); //Read the file icecream.dat
etc etc...
Clean and build main project works fine.
This is the error I get when I try to run:
Exception in thread "main" java.lang.IllegalArgumentException: Can't open file "icecream.dat" for input. (Error :java.io.FileNotFoundException: icecream.dat (The system cannot find the file specified)) at conecount.TextIO.readFile(TextIO.java:126) at conecount.Main.main(Main.java:21)
When I downloaded the .dat file from my school site, my computer assigned Nero as its default program. I changed it to Notepad thinking that might be the problem - a file association - but it still doesn't work. I can't find a specific help reference on the java or netBeans sites.
i am not sure if it is a file problem, or a problem with where I have saved the file.
Can anyone guide me?
Thanks.

New Topic/Question
Reply




MultiQuote




|