title: Loading a compiled class in Java and deserializing it's instance from a file
body: <p>I need to have an app that during run-time can load another class and deserialize one of it's instance successfuly so that it can run it's methods and read the member variables. </p>
  
  <p>From what I noticed, you can not serialize methods in Java, so I'm thinking about serializing the class instance in <code>project2</code>, load the compiled class with <code>ClassLoader</code> in <code>project1</code>, instantiate it and assign the deserialized instance from <code>porject2</code> in <code>project1</code> to the instantiated loaded class.</p>
  
  <p>The serialized class will inherit the same parent class in both projects.</p>
  
  <p>Is this the best way to go? It's a school project so the requirements are that my app can accept any other type of class without changing the code. </p>
  
  <p>TL;DR: My plan is to load a compiled class with the ClassLoader so that my project knows about that class (specifically the methods inside) and then load that serialized class instance inside the project so that I can get the data from the instance and together with the loaded class (now I know the methods aswell), run the methods on the deserialized instance.</p>