I have a server project in which I need to send an object via the server from one computer to another. The object is a SpecificGame, which extends Game. The server knows that the object it received is of type Game, but does not have access to SpecificGame or any other class that extends Game. The server would then pass this object on to another computer, and everything was fine.
I have multiple classes that extend Game (several computer games I'm working on use this server) and I am continually modifying and adding these classes, without modifying Game itself.
Recently, however, the server throws a ClassNotFoundException for SpecificGame, even though SpecificGame extends Game which the server recognizes. If I export Server as a jar from the same project folder as SpecificGame in eclipse, it works fine, however this means that I have to export the jar and restart the server every time I modify anything that extends Game and goes through the server.
I have been using the ObjectInputStream.readObject() method to read in the class that extends game, and this has been throwing the exception.
Please help me figure out what might be causing this.
Unfortunately, I cannot post code specifics online.
Thanks!