Reading Files using Forte ?

I was writting a little Java program to read a text file.

I created a text file in Forte and wrote some code

to open it and read it and I received a file not found

exception.

Could someone post some sample code to open

and read a file using readline().

Thanks

Tim,

[322 byte] By [JavaManTim] at [2007-9-26 3:33:14]
# 1
That exception is simply telling you that the location of the file or the file name that you are trying to read is not being found.
GLJdotcom at 2007-6-29 12:01:33 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2

The file is in the same directory as the java code.

I opened a DOS shell and went to that director.

The program ran ok from the DOS shell and displayed

the file I wanted to look at. But I get the exception

from the Forte enviorment.

Any Idea what I am doing wrong ?

Thanks for you help !

Tim,

JavaManTim at 2007-6-29 12:01:33 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3

Forte home directory is C:/forte4j, if the file is not in there and you do not specify the path it won't find it

File f = new File("C:/data/yourFile.txt");

FileReader fr = new FileReader( f );

LineNumberReader lnr = new LineNumberReader( fr );

for( int i = 0; i < graphics.length; i++ )

{

graphics[i] = lnr.readLine();

l = lnr.getLineNumber();

}

McGuiganJ at 2007-6-29 12:01:33 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 4
Thanks your for HELP ! I added the complete path to the code with forward slashes vs back slashesand it works fine.Thanks Tim,
JavaManTim at 2007-6-29 12:01:33 > top of Java-index,Archived Forums,New To Java Technology Archive...