Trouble Reading *.dat file in NetBeans with TextIO

TextIO.readFile(*.dat); issue in NetBeans - not reading file

Page 1 of 1

3 Replies - 5034 Views - Last Post: 05 December 2009 - 07:38 PM Rate Topic: -----

#1 re66or  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-December 09

Trouble Reading *.dat file in NetBeans with TextIO

Posted 05 December 2009 - 07:33 AM

Hello,

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.

Is This A Good Question/Topic? 0
  • +

Replies To: Trouble Reading *.dat file in NetBeans with TextIO

#2 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 562
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Trouble Reading *.dat file in NetBeans with TextIO

Posted 05 December 2009 - 08:28 AM

This should show you how to do it
HERE
Was This Post Helpful? 0
  • +
  • -

#3 g00se  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2774
  • View blog
  • Posts: 11,726
  • Joined: 20-September 08

Re: Trouble Reading *.dat file in NetBeans with TextIO

Posted 05 December 2009 - 08:40 AM

What is TextIO?
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: Trouble Reading *.dat file in NetBeans with TextIO

Posted 05 December 2009 - 07:38 PM

TestIO is an external package supposed to simplify simple IO
Use plain Java standard API classes and we might help
We won't support the thousand of third party libraries
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1