libjava (gcj) compatibility with Sun JDK for serialized objects ...

Bryce McKinlay
Wed Feb 7 04:19:00 GMT 2001

Hi Stan,

I'm cc'ing a copy of this reply to the gcj list.

Stan Chesnutt wrote:

> Hi:  Here's a question that isn't covered in the FAQs at
> ...
> I'm evaluating gcj for a project that involves transfer of
> serialized objects between Java applications, some compiled
> via gcj and some using the Sun JDK (1.2.2).
> If I serialize objects to a file via ObjectOutputStream.writeObject()
> on a gcj/libgcj system, then read those objects back into the
> VM on a Sun JDK system, will any errors occur?  Stated differently,
> are the serialization formats of libgcj and Sun's JDK identical?

Yes, gcj implements the serialization protocol as specified by Sun, so
serialized objects should be portable. I've briefly tested JDK<->gcj
interoperability with collections classes and things seemed to work
okay. However, differences in the implementations of some classes mean
that interoperability problems may occur. If this happens it may just a
bug in libjava, but in some cases the serialized form for a class is
poorly specified by Sun.


  [ bryce ]

More information about the Java mailing list