Um, no, the problem is that you are trying to serialise the FileOutputStream, fs. You should be trying to serialise the Forest, f.
The exception message told you that: it said that FileOutputStream was not Serializable, which it isn't!
Rahul is right to say that Tree needs to be Serializable, but that's not the cause of the exception you are currently getting.
By the way, this is an example of why you should not use short, meaningless identifiers like "f" and "fs" for your variables. If they were called "forest" and "fileStream", I bet you'd have spotted the problem. We're not writing FORTRAN-66 - you can have meaningful identifiers in Java. [ July 26, 2007: Message edited by: Peter Chase ]
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Nov 29, 2005
Originally posted by Peter Chase: Um, no, the problem is that you are trying to serialise the FileOutputStream, fs. You should be trying to serialise the Forest, f.
Yes , I did not notice.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com