Problem in java.io.IOException
Hello,
I have a class:
Code:
class.java throws IOException
In which I have code for try and catch block
I think my code has a problem with the java.ioexception. I tried many combination to sort this problem, but none was successful. If you have any idea of how to do it then please let me know.
Re:java.io.IOException not working
Hello,
Even I have a similar kind of a problem in my code. I would like to use a method of this class on a button also throw IOException. For this, I do:
Code:
static Public class test;
class = new class();
classified.method()...
when I run, I get an error on the button:
Code:
jButton1ActionPerformed(evt);
Here is the error:
Code:
unreported exception java.io.IOException; Must be caught or declared to be thrown
thank you for your hel
Re: Problem in java.io.IOException
Hello,
The IOException you back but you did not address why it jaws, that is they should be within proper parentheses. If you do not do so then you will get an error for that. I think you should post your code , so that it will be easy for use to understand the problem. I will recommend you to read the java exception on the sun's official site or from any other source and understand it first and then try to implement it in your code.
Re: Problem in java.io.IOException
Hello,
Just have a look at the below line
Code:
jButton1ActionPerformed(evt);
Where is this statement?
It must be in the try block associated with the catch:
Code:
try{....
jButton1ActionPerformed(evt);
.....
}
catch(IOException e){}
You can leave empty the catch block, your exception will still be treated
Re: Problem in java.io.IOException
Hello,
I think the problem is that, your code line
Code:
jButton1ActionPerformed(evt);
code is generated automatically. You can not change it.
You added the try / catch to:
Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) throws IOException {
try{ ...
}catch(IOException ioe){}
}
If you will not this in a proper way then you will get the following error when you are trying to compile your code.
Code:
jButton1ActionPerformed(evt);