j2me中使用Socket编写联网程序中的异常,期待高手给予赐教
在服务器端MIDlet中的startApp()方法中代码如下:protected void startApp() throws MIDletStateChangeException {
try {
ServerSocketConnection ssc=(ServerSocketConnection)Connector.open("Socket://:1234");
System.out.println("aaa");
SocketConnection sc=(SocketConnection)ssc.acceptAndOpen();
} catch (IOException e) {
e.printStackTrace();
}
}
但是运行后却出现了如下异常:
java.lang.ClassNotFoundException: com/sun/midp/io/j2me/Socket/Protocol
at javax.(+277)
at javax.(+15)
at javax.(+6)
at javax.(+5)
at ServerMIDlet.startApp(+5)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
java.lang.ClassNotFoundException: com/sun/midp/io/j2me/Socket/Protocol
at javax.(+277)
at javax.(+40)
at javax.(+6)
at javax.(+5)
at ServerMIDlet.startApp(+5)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
javax. The requested protocol does not exist Socket://:1234
at javax.(+72)
at javax.(+6)
at javax.(+5)
at ServerMIDlet.startApp(+5)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)