Unable to throw exception using FileOutputStream

I’m tryng to write a java services which writes a file. The problem with the code is its unable to thow exception in WM6.5. The same code in eclips throws an exception. If the location or when unable to write file to the location. Can anyone help me how to solve this.
// pipeline
IDataHashCursor pipelineCursor = pipeline.getHashCursor();
pipelineCursor.first( “file” );
String file = (String) pipelineCursor.getValue();
pipelineCursor.first( “dataWrite” );
String dataWrite = (String) pipelineCursor.getValue();
pipelineCursor.destroy();
try
{
FileOutputStream fout = new FileOutputStream( file, true ) ;
{
fout.write( dataWrite.getBytes() ) ;
fout.flush() ;
fout.close() ;
}
}
catch ( IOException e ) { System.err.println("Error in File " + e); }

Change your catch block to this:

catch (IOException e)
{
//System.err.println("Error in File " + e);
throw new ServiceException(e);
}