In both client and server classes, I have an exact same inner class called Data. This Data object is being sent from the server using:
ObjectOutputStream output= new ObjectOutputStream(socket.getOutputStream());
output.writeObject(d);
(where d is a Data object)
This object is received on the client side and cast to a Data object:
ObjectInputStream input = new ObjectInputStream(socket.getInputStream());
Object receiveObject = input.readObject();
if (receiveObject instanceof Data){
Data receiveData = (Data) receiveObject;
// some code here...
}
I'm getting a java.lang.ClassNotFoundException: TCPServer$Data
on this line Object receiveObject = input.readObject();
My guess is that it's trying to to look for the Data class in the Server side and can't find it, but I'm not sure... How do I fix this?