Re: Reading a file FileReader, doesn't read a file
Kgbol wrote:
...
'What Ingo said'. But in addition to that..
package czytaniezpliku
Please refrain from posting code that is not english.
You obviously speak English (whereas I am clueless
when it comes to ..Polish?) so it might help both me,
and any number of other developers who read the code
later, to have package (class, method and attribute)
names in English.
...
BufferedReader br = new BufferedReader(new
aaaaaaaaaaaaaaaaaaaaaaaaaaa
FileReader("plik.txt"));
Code posted with 'tabs' often becomes ridiculously
wide when posted to usenet. The string of 'a's above,
indicates where the 'BufferedRe..' text starts on the
previous line. Please replace tabs with a few spaces
before posting..
But to get to the point. That line of code is very bad
for purposes of debugging. Better to do something like..
File theFile = new File( "plik.txt" );
System.out.println( theFile.exists() + " " + file.getCanonicalPath() );
// ..go on to make a BufferedReader..
} catch (IOException e) {
System.out.println("B????d przy czytaniu");
And this.. (ick).
Note that 'e.printStackTrace()' not only 'speaks all languages'
(in a sense), but provides more information, and is also shorter.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200706/1