BufferedReader - reading in a line

I am trying to store each line of the file "fixtures.txt" as a String in the array fixtures[]. I have used a similar method in a different class, but for some reason it won't read, it just keeps throwing the exception.

publicvoid getUpcomingFixtures(){

String line ="";

int n = 0 ;

try{

File fixturesFile =new File("home/andy/1/Project/src/fixtures.txt") ;

FileReader fixturesFileReader =new FileReader(fixturesFile) ;

BufferedReader fixtureIn =new BufferedReader(fixturesFileReader) ;

n = 0 ;

while ( ( line = fixtureIn.readLine() ) !=null ){

fixtures[n] = line ;

n++ ;

}

fixtureList.setListData( fixtures ) ;// update list with fixtures

}catch (Exception e){ e.printStackTrace() ;}

}

i also tried it with the following change (assuming "fixtures.txt" is 20 lines long)

while ( n < 20 ){

line = fixtureIn.readLine()

fixtures[n] = line ;

n++ ;

}

It's probably a simple mistake, as I am reusing code from another class. Can anyone help me please?

Thanks

[1819 byte] By [Shorinhioa] at [2007-11-27 11:05:05]
# 1

> but for some reason it won't read, it just keeps throwing the exception.

The exception?

Hippolytea at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 2

$10 says your problem is right here: File fixturesFile = new File("home/andy/1/Project/src/fixtures.txt") ;

Ok, not really $10. But still. try "/home/andy/1/Project/src/fixtures.txt

"

jGardnera at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 3

Hey, what happened to $10 on

fixtures[n] = line ;

?

And what is that in euros, 1.50?

Hippolytea at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 4

thanks!

Shorinhioa at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 5

> thanks!

You don't get the money sent to you by paypal until you tell us what the exception was.

Hippolytea at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 6

> > thanks!

>

> You don't get the money sent to you by paypal until

> you tell us what the exception was.

Who cares? I win, you lose :P

Stack traces? who needs em?

Edit: Google didn't cache anything; you can't prove anything.

Message was edited by:

jGardner

jGardnera at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 7

> > thanks!

>

> You don't get the money sent to you by paypal until

> you tell us what the exception was.

Judging by the "thanks!" he said to my response, I can tell you that he got a java.io.FileNotFoundException

jGardnera at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 8

well u can probably keep the $10 then because i was using netbeans and it's part of a GUI, i was just building and running it, so if i bothered to use command line I probably would know what the problem was! just made a mistake copying&pasting code. Thanks anyways

Shorinhioa at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...
# 9

> so if i bothered to use command line I probably would know what the problem was!

The Buddha once said of an ignorant man, "his actions are his punishment".

Hippolytea at 2007-7-29 13:06:18 > top of Java-index,Java Essentials,New To Java...