Processing Forum
<!doctype html> | |
<html> | |
<head> <meta http-equiv="X-UA-Compatible" content="IE=9" > |
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title> MyPjs </title> | |
<style type="text/css"> | |
body { | |
background-color: #333; color: #bbb; line-height: normal; | |
font-family: Arial, sans-serif; | |
font-size: 11px; font-weight: normal; text-decoration: none; | |
line-height: 1.5em; | |
} | |
a, a:link, a:visited, a:active, a:hover { | |
color: #cdcdcd; text-decoration: underline; | |
} | |
h1 { | |
font-family: Arial, Helvetica Neue, Verdana, Geneva, sans-serif; | |
width: 100%; letter-spacing: 0.1em; | |
margin-bottom: 1em; font-size: 1.65em; | |
} | |
</style> | |
<!--[if lt IE 9]> | |
<script type="text/javascript">alert("Your browser does not support the canvas tag.");</script> | |
<![endif]--> | |
<script type="text/javascript">function getProcessingSketchID () { return 'MyPjs'; }</script> | |
</head> | |
<body> | |
<div id="content"> | |
<script src="processing.js" type="text/javascript"></script> | |
<canvas id="MyPjs" data-processing-sources="MyPjs.pde" | |
width="1024" height="700"> | |
<p>Your browser does not support the canvas tag.</p> | |
<!-- Note: you can put any alternative content here. --> | |
</canvas> | |
<noscript> | |
<p>JavaScript is required to view the contents of this page.</p> | |
</noscript> | |
<script type="text/javascript"> | |
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; | |
var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number | |
if (ieversion>=9) | |
document.write("<br>If you are on IE9 and cannot see the sketch, please press F12 twice an then reload the page.") | |
} | |
</script> | |
</body> | |
</html> Any tips on explanations, further reading or guides would be great. |
|
Anyone got any insights in this?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?