title: How to deserialize from a file to different class
body: <p>I serialize a <code>ArrayList&lt;packageA.Changelog&gt; list</code> to a file and transmitted the file to another system in another machine.</p>
  
  <p>And since it's a different system that received the file, I don't have the same <code>packageA.Changelog</code> class, instead is a <code>packageB.Changelog</code> which has exactly same structure but in different package.</p>
  
  <p>And when I use</p>
  
  <p><code>ArrayList&lt;packageB.Changelog&gt; changelogs = (ArrayList&lt;packageB.Changelog&gt;)ois.readObject();</code></p>
  
  <p>to read out from the file I got a <code>ClassCastException</code>.</p>
  
  <p>How to avoid this exception? Do I need to create the same package structure in the other system only for receiving the list? </p>