• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in openning serial port

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I used the following code to open serial port on nokia N70 mobile

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.CommConnection;
import javax.microedition.io.Connector;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.*;

/**
* @author mostafa
*/
public class Serializer extends MIDlet {
Connector con;
OutputStream os = null;
CommConnection cc = null;
InputStream is = null;
Alert alert;
int i=0;

public void startApp() {

try {
cc = (CommConnection) Connector.open("comm:com0;baudrate=19200");
i=1;
//int baudrate = cc.getBaudRate();


is = cc.openInputStream();
i=2;


os = cc.openOutputStream();
i=3;
int ch = 0;
while(ch!=10)
os.write('k');
i=4;
cc.close();
i=5;
os.close();
i=6;
}
catch (Exception ex) {
String s= ex.getMessage();
alert = new Alert("Problem");
alert.setString(s+""+"i="+i);
alert.setTimeout(alert.FOREVER);
Display.getDisplay(this).setCurrent(alert);

}

}
public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}
}


And the output on the mobile screen was:
java.lang.ClassNotFoundException: com/symbian/midp/io/protocol/comm/Protocol
i=1
(which means it throwed the exception during this command: cc = (CommConnection) Connector.open("comm:com0;baudrate=19200");)

Can any one tell me what is wrong?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic