Error in reading from file (Java) -


i posted similar question here: read file containing integers - java couldn't decent reply.

now have written new code reads file , outputs result.

i filenotfoundexception whenever try read file. code below:

import java.io.*; public class second { /** * @param args * @throws ioexception */ public static void main(string[] args) throws ioexception { file f = new file("c:\\users\\haroon\\workspace\\ppp\\temperature.txt"); filereader file = new filereader(f); bufferedreader buf = new bufferedreader(file); string s = null; while((s = buf.readline()) != null){ system.out.println(s); } } 

}

this strange because file in project's folder. appreciated.

that should work. go location of file, copy path, paste in code, , escape slashes. missing something.

also check name/extension of file correct, have "temperature.txt.txt".


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -