Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthoradmin
    • CommentTimeFeb 13th 2008
     
    This forum is for discussing questions related to Project 4
    • CommentAuthorcbdirks
    • CommentTimeMar 4th 2008
     
    I'm having trouble figuring out how to implement my "throws IOException".
    Whenever I am closing my filechannels and filestreams, its telling me IOException must be caught or declared to be thrown.

    finally {
    fcin.close() ;
    fcout.close();
    istream.close();
    ostream.close();
    } else {
    System.out.println( "Provide input and " +
    "output filenames" );
    }
    • CommentAuthormdcarr
    • CommentTimeMar 4th 2008
     
    I can't get that far still... I'm getting FileNotFoundException on my input streams.. not sure what I'm overlooking, I've been going through a few different programs trying to figure it out, just can't get it going when the file names are coming from the textboxes
    • CommentAuthorcdstreit
    • CommentTimeMar 4th 2008 edited
     
    on the throws IOException, i had that problem too, and because i am implementing ActionListener i can not add throws to the method. So to get around this i put all the close methods in another try-catch. so I have something like
    finally{
    try{
    the close stuff
    } catch IOException(object)
    { a message}
    }
    • CommentAuthorcdstreit
    • CommentTimeMar 4th 2008 edited
     
    On the FileNotFoundException, does it work if say you put the infile.txt in c:\ dir (aka drive root dir) and type in c:\infile.txt. I had some problems with file not found, because of the way eclipse handles the path of the compiled program. If you use eclipse and don't want to put a full path to the files, you have to put it in the project directory and not the bin or src directory.

    Hope this helps
    • CommentAuthordtran
    • CommentTimeMar 4th 2008
     
    What is this try-catch suppose to do any ways? I don't understand how adding another try-catch would work.
    • CommentAuthormdcarr
    • CommentTimeMar 4th 2008
     
    I tried putting a direct path into the program "c:\infile.txt" moved a copy of the infile there but it still errors, it keeps erroring saying it can't find the file. I've tried a few different ways and get one error or another that it can't find something... going through different code examples online trying to find my problem or figure out another apporoch..
    • CommentAuthordtran
    • CommentTimeMar 4th 2008
     
    Got this project 4 to run, finally. I didn't put the finally clause in it, just the try and catch. Pretty much after I got my GUI up, I added some button listeners and added project 2 codes to it. Changed the args to a varible that reads what the user input. Had the same problem as Chad with the finally causing errors but once I got rid of it, the code worked fine. Don't know if the finally is important. It might come back and bite me later down the road for not understanding how to use.
    • CommentAuthormdcarr
    • CommentTimeMar 5th 2008
     
    finally got it going also, had to leave out the finally statements also. figure worse case lose a couple points for that, at this point I'm just happy it runs lol