If you have a java program running on one operating system somewhere and remotely have another java program running on another operating system - can you create a serialized object with program1, send it somewhere (ftp for example) to program2 and have program2 deserialize it and use that object (assuming the code includes the same class, etc). Or, is a serialized object only to be used by the program with which it was created (or only used on the system on which it was created, etc). Another way to phrase the question: Is that serialized object strictly the object as it was created in the program or does that serialized object include other information (system information)?
Absolutely you can use it on another JVM; that's what is so darn cool about RMI, for example!! Assuming you do not have versioning problems with the object/class itself (in other words, as long as the correct version of the class is where the object needs to be deserialized, then it should work just fine. There are issues that surround how you actually GET that class to the *other* side, but that's a different (and more advanced) discussion. Moving serialized objects from one machine to another is the key foundation to Java's distributed remote method invocation (RMI). In RMI, an object in a heap on JVM A is calling a method on an object in another heap on JVM B (which could mean a different physical machine with a different operating system, but that doesn't matter!), and the arguments and return values are passed (if references to objects) as serialized copies of the actual objects. So if I have a PetOwner on one machine passing a reference to a Dog to a method of a Vet object running on a different machine, then that Dog object will be serialized and shipped over. Which means the Vet object now has a COPY of the actual Dog object. This foundation is the basis for other Java distributed technologies including Jini and Enterprise Javabeans (EJB), so if it didn't work that way, then communications between clients and servers would be very restricted. Good question! cheers, Kathy