We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Serializing and exporting objects
Page Index Toggle Pages: 1
Serializing and exporting objects? (Read 657 times)
Serializing and exporting objects?
Aug 9th, 2006, 7:57pm
 
I've got a sketch with a some class instances I'd like to export (basically, it's an evolution-simulation with a population of boids). All the involved classes implement Serializable, and java.io.* is imported for the entire sketch.
However, I get the following error:

java.io.NotSerializableException: processing.core.PApplet$RegisteredMethods

(I got a different notSerializable-exception when I used OpenGL, but OpenGL isn't really necessary in this situation [neither is P3D]).
I've got the following code (all in seperate try-catch blocks):

f_out= new FileOutputStream("winner.data");
ObjectOutputStream obj_out = new ObjectOutputStream (f_out);
obj_out.writeObject ( boid[0] ); // the exception above is thrown here

the boid[0]-instance is the boid with the best fitness after x generations, and that class instances some other classes of my own making, but as I mentioned, they all implement Serializable.

Soooo what do I do?
Page Index Toggle Pages: 1