• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading a text file

 
Mohamed Manas
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am trying to read data from a text file named "myFile.txt".
Although the text file is in the same directory with the class JVM throws the FileNotFoundException.
I've added the code here. Is there a flow in the coding?
Thanks in advance.
 
Joe Ess
Bartender
Posts: 9337
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default the classes in the java.io package always resolve relative pathnames against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked.

java.io.File

Try invoking getCanonicalPath() on the File instance to see where exactly the JVM is looking.
[ June 06, 2008: Message edited by: Joe Ess ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic