Results 1 to 5 of 5

Thread: Problem in java.io.IOException

  1. #1
    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.

  2. #2
    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

  3. #3
    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.

  4. #4
    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

  5. #5
    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);

Similar Threads

  1. Java JDK problem
    By Samara in forum Software Development
    Replies: 6
    Last Post: 19-07-2010, 01:02 PM
  2. Problem in java annotation
    By Remedy in forum Software Development
    Replies: 5
    Last Post: 28-02-2010, 05:11 AM
  3. Java Problem
    By suhjonathan in forum Windows Software
    Replies: 5
    Last Post: 12-11-2009, 09:48 AM
  4. IOException while using ProcessBuilder class
    By Patio in forum Software Development
    Replies: 2
    Last Post: 16-04-2009, 10:17 PM
  5. Problem With Java
    By Kusagra in forum Software Development
    Replies: 2
    Last Post: 17-03-2009, 11:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,842,347.02466 seconds with 16 queries