Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
willemmali
willemmali's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Serialisation problem
[1 Reply]
12-Jul-2013 11:12 AM
Forum:
Programming Questions
Hi,
I'm making a 2D Minecraft clone, and yes, that's very original.
I'm trying to serialise the blocks now, but I get an exception.
This is the code I'm using to serialise the blocks:
(part of the Chunk class)
void saveBlocks() {
try {
for (int x = 0; x < Width; x++) {
for (int y = 0; y < Height; y++) {
File f = new File(+0+"_"+0+".bl");
if (f.canWrite()) {
FileOutputStream fileOut = new FileOutputStream(f.getAbsolutePath());
ObjectOutputStream out = new ObjectOutputStream(fileOut);
out.writeObject(blocks[x][y]);
out.flush();
out.close();
fileOut.flush();
fileOut.close();
println("XXX SUCCES XXX");
}
else {print(".");}
}
}
}
catch(Exception i){
i.printStackTrace();
}
}
And this is the exception:
java.io.NotSerializableException: com.jogamp.nativewindow.awt.AWTGraphicsConfiguration
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1346)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1154)
at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:143)
at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1677)
at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:462)
at java.awt.Container.writeObject(Container.java:3590)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:940)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at e006v016$Chunk.saveBlocks(e006v016.java:525)
at e006v016$ChunkManager.replaceChunk(e006v016.java:922)
at e006v016$ChunkManager.update(e006v016.java:907)
at e006v016.draw(e006v016.java:68)
at processing.core.PApplet.handleDraw(PApplet.java:2270)
at processing.opengl.PGL$PGLListener.display(PGL.java:2643)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:576)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:561)
at javax.media.opengl.awt.GLCanvas$7.run(GLCanvas.java:1054)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1024)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:899)
at javax.media.opengl.awt.GLCanvas$8.run(GLCanvas.java:1065)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:708)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:669)
at java.awt.EventQueue$2.run(EventQueue.java:667)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:678)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
What am I doing wrong here? I didn't even know my class implemented "com.jogamp.nativewindow.awt.AWTGraphicsConfiguration".
«Prev
Next »
Moderate user : willemmali
Forum