reading a txt file in netbeans
807588May 19 2009 — edited May 19 2009Hi, i am trying to read a txt file containing dictionary words. I searched online and did find some code to help do this, when i did compile and run it using jgrasp, it worked perfectly, but when i did copy d code and put it in my project in netbeans, it throws the filenotfound exception. Please any ideas on how to do this on netbeans??
code:
import java.io.BufferedReader;
import java.io.FileReader;
public class Dic
{
public static void main(String args[])
{
try
{
//FileReader fread=null;
BufferedReader bread = new BufferedReader(new FileReader("dic.txt"));
String line;
while((line=bread.readLine())!=null)
{
String[] tkn =line.split(",");
for(int i=0; i<tkn.length;i++)
{
String s=tkn;
System.out.println(s);
}
}
}
catch(Exception e)
{
System.out.println("Exception: " + e);
}
}
}