This is a major stumbling block for me every time. As I learn new methods I will keep updating .
For now here is the simplest :
FileReader f = new FileReader("tmp.txt");
Now where the hell do u place tmp.txt, you might ask. Well, to find where Java tries to look for tmp.txt, do this
System.out.println(System.getProperty("user.dir");
To open a file relative to the class file location is something that would really help. And it is supposed to work by using class.getClassLoader().getResourceAsStream(), but it didnt work for me, will post as soon as I know how it works.
Tuesday, October 05, 2004
Subscribe to:
Posts (Atom)