Kids These Days...

The system cannot find the file specified

two hours to figure this out??

[Thanks to http://forums.java.net/jive/thread.jspa?threadID=36207&tstart=150]

"highscore.txt" should be in your project's base directory, not in any of the directories that NetBeans has created for you. In your case, it should be in:

C:\Documents and Settings\Collin\My Documents\NetBeansProjects\Yahtzee

Alternatively, you can find out where your file points to in your Java code:

File file = new File("highscore.txt");
System.out.println(file.getCanonicalPath());

This should output the system-dependent, unique path to where the virtual machine believes the file is, so you can see where the discrepancy is.

0 comments:

Post a Comment