Help With Netbeans dat files

Status
Not open for further replies.

john1992

Honorable
Jan 22, 2014
9
0
10,510
Caution, extreme noob.

This is netbeans specific, sadly over on their forums they don't answer topics. *sigh*. Anyway, I'm having trouble reading from a dat file, not sure how to set this program up to read from dat files.

For example:
Scanner reader=new Scanner(new File("lab10d.dat");

When I try to run this, the error is "java.io.FileNotFoundException: lab10d.dat". Where do I need to place this dat file, for this program to find it?

Thanks in advance.

 


This is correct.

By default it will look for it in $PWD (Present Working Directory) on POSIX based operating systems or the user.dir property on Windows
 

john1992

Honorable
Jan 22, 2014
9
0
10,510
Well, I attempted to do something, this is what I've got now.

String path = "j:\\student files\\student folders\\lab10 - arrays\\lab10d.dat";
path = path.replaceAll("\\", "/");
Scanner reader=new Scanner(new File(path));

I know this is wrong, but I attempted to use an absolute path. Can someone point out where this is wrong, exactly?
 
Status
Not open for further replies.