Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

***Need help with IOException *************** 1

Status
Not open for further replies.

DaniDak

Technical User
Mar 13, 2002
44
0
0
US
I get the following Exception thrown when I try to save (write) the image ThumbPanel objects to a file:
IOException: java.io.NotSerializableException: sun.awt.AppContext.
The strange thing about it is that the Exception is not thrown every time i try to use the write method..
Can anyone help me correct this problem and tell me what the IOException thrown actually means, and why it is thrown in the first place.

Thank you.


the method where I get the error:
/**
Writes out this ThumbPanel's data to out.
@param out The file to which the data is written.
*/
public void write(ObjectOutputStream out)
{
try
{
out.writeObject(data);
}
catch (IOException E)
{
System.err.println("IO Exception: " + E); /////////////////
//I get the following error// IOException: java.io.NotSerializableException: sun.awt.AppContext
//////////////////
}
}
 
That exception means that the object your attempting to serialize does not implement the Serializable interface.

>> out.writeObject(data);

In your case that is the "data" variable.

-pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top