Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 25-02-2010
Member
 
Join Date: Nov 2009
Posts: 518
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
Code:
try/catch
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.
Reply With Quote
  #2  
Old 25-02-2010
Member
 
Join Date: Dec 2009
Posts: 204
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
Reply With Quote
  #3  
Old 25-02-2010
Member
 
Join Date: Nov 2009
Posts: 343
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.
Reply With Quote
  #4  
Old 25-02-2010
Member
 
Join Date: Nov 2009
Posts: 359
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
Reply With Quote
  #5  
Old 25-02-2010
Member
 
Join Date: Nov 2009
Posts: 583
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);
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem in java.io.IOException"
Thread Thread Starter Forum Replies Last Post
Java JDK problem Samara Software Development 6 19-07-2010 01:02 PM
Problem in java annotation Remedy Software Development 5 28-02-2010 05:11 AM
Java Problem suhjonathan Windows Software 5 12-11-2009 09:48 AM
IOException while using ProcessBuilder class Patio Software Development 2 16-04-2009 10:17 PM
Problem With Java Kusagra Software Development 2 17-03-2009 11:46 PM


All times are GMT +5.5. The time now is 04:05 PM.