F
fybar
New to java. I have a snippet of code that I can compile fine on a FreeBSD
box running 1.1.4, or something similar:
FileInputStream fs = new FileInputStream(f);
InputStreamReader sirLine;
BufferedReader fileInput;
sirLine = new InputStreamReader(fs);
fileInput = new BufferedReader(sirLine);
while ( j <= 53 ) {
fileline = fileInput.readLine();
I just installed NetBeans 5.0 on WinXP as my FreeBSD box isn't portable. I
loaded the source files and now I get an error for the first line that
says:
unreported excpeption java.io.FileNotFoundException; must be caught or
declared to be thrown
I get the same error for the last line. Ok, not sure what that meant so I
googled and came up with this:
try{
FileInputStream fs = new FileInputStream(f);
}
catch(FileNotFoundException fnfE){
System.err.println("File not found!");
}
InputStreamReader sirLine;
BufferedReader fileInput;
sirLine = new InputStreamReader(fs);
fileInput = new BufferedReader(sirLine);
while ( j <= 53 ) {
fileline = fileInput.readLine();
Ok, that made the original error go away and I think I understand why.
Seems like NetBeans is tying to make me write fault tolerant code, jerk.
However I have a new error that I don't understand. The sirLine = new...
line gives me:
cannot find symbol
symbol : variable fs
location: class hockey_pool.Main
I have googled for this and cannot find what this means. I thought that it
meant that I have not defined a variable, but I have in the line in the
try{}. So, what am I missing here?
Thanks,
fybar
box running 1.1.4, or something similar:
FileInputStream fs = new FileInputStream(f);
InputStreamReader sirLine;
BufferedReader fileInput;
sirLine = new InputStreamReader(fs);
fileInput = new BufferedReader(sirLine);
while ( j <= 53 ) {
fileline = fileInput.readLine();
I just installed NetBeans 5.0 on WinXP as my FreeBSD box isn't portable. I
loaded the source files and now I get an error for the first line that
says:
unreported excpeption java.io.FileNotFoundException; must be caught or
declared to be thrown
I get the same error for the last line. Ok, not sure what that meant so I
googled and came up with this:
try{
FileInputStream fs = new FileInputStream(f);
}
catch(FileNotFoundException fnfE){
System.err.println("File not found!");
}
InputStreamReader sirLine;
BufferedReader fileInput;
sirLine = new InputStreamReader(fs);
fileInput = new BufferedReader(sirLine);
while ( j <= 53 ) {
fileline = fileInput.readLine();
Ok, that made the original error go away and I think I understand why.
Seems like NetBeans is tying to make me write fault tolerant code, jerk.
However I have a new error that I don't understand. The sirLine = new...
line gives me:
cannot find symbol
symbol : variable fs
location: class hockey_pool.Main
I have googled for this and cannot find what this means. I thought that it
meant that I have not defined a variable, but I have in the line in the
try{}. So, what am I missing here?
Thanks,
fybar