请教老师一个问题
我在客户端中这么写
socket = new Socket(ip, 23456);
oos = new ObjectOutputStream(socket.getOutputStream());
oos.writeObject(transfer);
oos.flush();
服务器端学老师这么写
ois = new ObjectInputStream(socket.getInputStream());
CammandTransfer transfer = (CammandTransfer) ois.readObject();
但是出现了这种错误
java.lang.ClassNotFoundException: com.android.yunnotes.CammandTransfer
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:340)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:626)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at com.myserver.main.ServerThread.run(ServerThread.java:23)
23行就是那句CammandTransfer transfer = (CammandTransfer) ois.readObject();
这是什么问题呢
补充com.android.yunnotes是客户端的包,com.myserver.main是服务器的包