I am trying to pick up Java and want to test with the Java client / server so that the client sends a simple object of a self-defined class (Message) to the server. The problem was that I kept getting a ServerName ClassNotFoundException.
I think the rest of the codes look fine, because other objects like String can pass without problems.
I had two different netbeans projects in different places for each client and server.
Each of them has its own copy of the Message class under their respective packages. The message class implements Serializable.
On the client side, I am trying to send a Message object via.
On the server side, by calling the readObject method, it seems like looking for the Message class from the client package instead of its own. printStackTrace showed: "java.lang.ClassNotFoundException: client.Message" on the server side
I did not even try to display or save the resulting object. Is there something I forgot?
java classnotfoundexception client
eruina
source share