Results 1 to 4 of 4
Thread: Serializing a class
- 04-14-2011, 01:07 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 2
- Rep Power
- 0
Serializing a class
Hi experts, I have a question regarding serializing a java class (not object). I know Class implements the Serializable interface. I encountered a problem when deserializing a Class. The error basically says "failed to build body from bytes. Reason: java.io.IOException: some class name". What's the possible problem? Of cause, when deserializing, the class definition was not preloaded on the classpath... that's why I need to serialize the Class definition and send it a remote server.
Thanks!!!
- 04-14-2011, 02:23 AM #2
Yes but because Class is a generic class that points to the real class, it needs to have a copy of the real class that it represents to be able to be rebuilt.
- 04-17-2011, 07:03 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 2
- Rep Power
- 0
- 04-17-2011, 09:37 PM #4
Serialization is used to preserve the instance variable values. If you want to send a .class file to another location, you are going to have to looking ClassLoader and other classes to be able to load this class into the runtime.
Similar Threads
-
Serializing
By shashanksworld in forum New To JavaReplies: 7Last Post: 03-29-2010, 04:47 PM -
serializing pdf files
By windie in forum New To JavaReplies: 0Last Post: 03-11-2009, 04:46 PM -
Object not serializing
By MamboBanda in forum New To JavaReplies: 1Last Post: 08-12-2008, 12:15 AM -
Serializing Arrays
By javaplus in forum New To JavaReplies: 3Last Post: 11-08-2007, 09:09 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks