Establishing serial port connections through J2ME

Respected Friends,
I wanted to establish a connection with the serial port through my J2ME application.I am writting the following code it compiles(build) successfully but it is throwing exception which means that the Sun's J2ME wireless toolkit does'nt supports serial port connection,can any one please tell me the reason why the toolkit is not supporting serial port and if there is any mistake in the code what is it,I am using J2ME Wireless toolkit 1.0(Version 1.0) the code is as follows:
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import java.io.*;
public class TestSerial extends MIDlet implements CommandListener
Form form1;
TextField tf1;
Display disp1=null;
Command command1;
StreamConnection sc;
OutputConnection oc;
Connection connection1;
/****************************DefiningConstructor*****************************/
public TestSerial()
disp1=Display.getDisplay(this);
command1=new Command("Start",Command.OK,1);
form1=new Form("Serial Port Connection");
form1.addCommand(command1);
form1.setCommandListener(this);
public void startApp()
disp1.setCurrent(form1);
public void pauseApp()
public void destroyApp(boolean b)
public void commandAction(Command c,Displayable d)
if(c==command1)
try
/************Establishing serial port connection****************/
connection1= Connector.open("comm:0;baudrate=9600");
connection1.close();
catch(Exception e)
System.out.println(e.toString());
}Please mail your precious suggestions regarding this problem as soon as possible.
Thanking You,
Taqi Raza.

I am not sure about sun wireless toolkit 1.0,
check the settings, -> permissions... (We have this in sun wireless toolkit 2.3, where i can set the security options)
Hope it helps...

Similar Messages

  • Help needed in serial port connection

    I tried to write a midlet such that an emulator can get images from a webcam which shall is attached to the serial port of a cell phone. But I always get the following error message:
    IOException:javax.microedition.io.ConnectionNotFoundException: The requested protocol does not exist comm:0;baudrate=9600
    My code appears as follows:
    InputConnection cc;
    DataInputStream inc;
    static byte img_data[];
    static int frame_len = 30000;
    public void start()
    try
    System.out.println("I am here:");
    cc = (StreamConnection)Connector.open("comm:0;baudrate=9600");
    //************* I can't pass through here
    //I also try to use
    //cc = (StreamConnection)Connector.open
    //("comm:0;baudrate=9600;bitsperchar=8;stopbits=1;parity=none");
    // to do it, but get same problem
    inc = new DataInputStream(cc.openDataInputStream());
    inc.readFully( img_data);
    catch (IOException e)
    {   System.err.println("IOException:" + e);  }
    finally
    // free up the I/O stream after use
    try { if (inc != null ) inc.close(); }
    catch (IOException ignored) { System.err.println ("Exception:" + ignored); }
    // free up the connection after use
    try { if ( cc != null ) cc.close(); }
    catch (IOException ignored) { System.err.println("Exception:" + ignored); }
    System.out.println("I am ok:");
    Does anybody know some reasons that probably lead to this error.
    thanks in advance

    well, as i know, midp 1.0 does not support serial connections, actually, any connection type other than http connection.
    this is my problem noeadays too, is it practically possible to use serial connection under midp.
    have you had any improvements since than?

  • Serial port communication through JSP

    i am developing web application and i want to connect RFID reader to serial port to client computer.so when user put thr card on RFID READER and press Read Button on JSP page .the information stored on card display on the web page.
    this is requirement of my application.
    can i do this with JSP page or i have to change the technology
    plz help me
    plz reply as asoon as possible
    thanx in advance
    THANKS & REGARDS
    vikas

    http://java.sun.com/developer/Books/javaprogramming/cookbook/11.pdf

  • J2ME in Pocket PC - sockets - serial port

    Hi Guys,
    I am writing a J2ME application for a Pocket PC using Windows Mobile 2003
    I have chosen the J9 VM to run my J2ME applications on the PPC.
    My application will use tcp/ip sockets communication to connect to a server. Do you know if there are any issues of using this part of J2ME on a Pocket PC?? ( I have tested the same application on Java enabled mobile phone and it is fine)
    I also want to access the serial port from my J2ME application (read/write data). Do you know if it is possible to do it on a Pocket PC through the normal way?? (using the javax.microedition.io package??)

    evelknievel you said that implemmented bluetooth
    connection like a serial link, where can i find some
    documentation to do that?i am sorry, that i cannot offer you a link to a tutorial, because i just tried it out by myself using an iPAQ h5550 with windows CE 4.2 (i think this is equivlent to PocketPC 2003, or 2003 SE) which is able to create such connections. the bluetooth-driver of each side of your "serial bluetooth link" has to implement the so called "serial port profile". maybe you should google for it...
    i found some information on this:
    "To open the connection using the:
    * PocketPC
    o Most Bluetooth drivers for PocketPC provide the mapping between Bluetooth serial ports and virtual COM (inbound/outbound) ports. For example WIDCOMM Bluetooth driver (BTW-CE 1.4) that comes with hp iPAQ h5550 by default assigns COM port 5 as the inbound Bluetooth serial port and COM port 8 as the outbound Bluetooth serial port. These COM ports are configurable from the driver's Bluetooth manager."
    i found it here:
    http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/15987c8cb752ead786256dc20070b433?OpenDocument
    hopefully this information is useful to you or anybody else :)
    best regards
    evelknievel

  • Problem connecting N79 to serial port using blueso...

    Greeetings to All,
    I have a big problem, when i connect my n79 using bluesoleil v3.0, i got File transfer, dialup networking and object push services only.
    If i try to start serial port service to connect my n79 to a serial port it displayes error "can not start service".
    i have tried various bluesoleil versions but the problem remains same everytime. on the other hand i can connect my sony k750i to a serial port without any problem.
    can someone tell me how to connect n79 to a serial port using bluesoleil
    OR
    Does N79 not support bluetooth serial port connectivity?
    or is there any other way to connect n79 to a serial port using blesoleil and my bluetooth dongle on a WINXP SP2 system?
    Thanks in Advance

    Yes, PCSuite supports a great deal of Bluetooth drivers. These are all built in so, give it a try.
    Windows Vista x32 en x64 editions:
    Microsoft Windows Bluetooth stack
    Toshiba Bluetooth stack, driver versie 5.10.12
    IVT BlueSoleil Bluetooth stack, driver versie 5.0.5
    Windows XP x64:
    Microsoft Windows Bluetooth stack
    Toshiba Bluetooth stack, driver versie 5.10.12
    IVT BlueSoleil Bluetooth stack, driver versie 5.0.5
    Windows XP:
    Microsoft Windows Bluetooth (enkel in Service Pack 2)
    Toshiba Bluetooth stack, driver versie 4.0, 5.0 and 5.10.12
    WIDCOMM Bluetooth stack, driver versie 1.4.2, 3.x, 4.x and 5.x
    IVT BlueSoleil Bluetooth stack, driver versie 2.x, 3.x and 5.0.5
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • Palm desktop installation on Win 7--?serial port will work

    Still syncing on my old laptop.  Tried to use the palm desktop CD to install
    ver 4.1 for my Kyocera 7135 on on win 7 64 bit machine.  It wouldn't run the installation program.  I had a virtual PC installed anyway and got the desk top installed on that machine.
    I had to enable the USB port for it to sync and the program ran---but no data exported to the PC!!???
    Have no clue what is wrong.  I read that a few people have had the sync work with a serial port connection.
    I have an express port on the new laptop and wonder if the virtual machine will use that OK and if that will fix
    the lack of data transfer.  Perhaps through in the towel and use the old laptop to sync but that will only work for awhile.
    Thanks for any comments.
    Mike
    Post relates to: Pre 2 p102una (Rogers)

    Just for the heck of it, I did a factory reset on the iPad again, and gave it another shot on the Win 7 64 machine at home. I uninstalled iTunes, restarted the computer, installed iTunes 9.1.1 64 bit for Windows, and achieved the exact same results: impossible to get iTunes to sync Google Contacts to the iPad. It goes through the motions, but never delivers any contacts to the iPad.

  • Serial port doesn't close properly

    I'm working with the RXTX comm APi to connect a java application (jdk 1.5) with a mikrocontroller via a virtual serial port (using WinXP). I'm only jumping to certain addresses of the controller and then write into or read from them.
    After some tricky problems that were already discussed in this forum I now encountered a new one:
    After I finished my communication with the controller, I want to make a clean shutdown by closing the input- and outputStream, removing the SerialEventListener and finally closing the serialPort.
    When I'm doing the latter, the program suddenly hangs totally. No exception is thrown and I have to terminate the application through the ide.
    I monitor all the port traffic with "portmon" from sysinternals and it tells me that around 5 minutes after I tried to close the port, the javaw-process finally sends "IRP_MJ_CLEANUP" and "IRP_MJ_CLOSE".
    Sometimes only the first one is sent, what makes it impossible to connect to the port again without a restart of windows (port in use by unkown application).
    I don't have the sourcecode right with me now, so I can't post some examples. However I'm basically doing nothing else then most of the other sourcecodes concerning serial port connections posted in this forum. Anyway I will post some code later.
    But for now, has anybody some ideas what could be the problem?
    ********* EDIT **********
    Seems that it's not necessary to post my sourcecode because the same problem occures when I'm running the SerialDemo from the javax.comm 2.0 API.

    Here's an update.  The serial port works fine, as long as I don't have any I/O pci cards in the machine.  Both my Adaptec SCSI controller and a Pinnacle AV card cause the same malfunction with the serial port.  When those cards are removed, it works!  No conflicts with IRQ or anything that I can see.....no errors reported by windows device manager.
    P

  • Serial Ports, is it supported on MAC & Linux ??

    Hey all...
    After a long process of doing an application that runs a serial port connection to a server and upload a file to it, i could'nt find the comm package that i could download for both MAC and Linux.... There is one for Windows and Solaris though... So i was wondering, is serial ports not supported by MAC and Linux. And if not, what other than the comm package can i use to have serial ports on those 2 platforms .......
    Thanks

    Yes, there is third party support for linux and MacOS-X. It's released under GPL and can be found here -> http://www.rxtx.org/

  • Problems with serial port synchronization.

    Hello to all!
    I have an oxygen analyser, the equipment has a serial port for communication, being based the communication on the AK communication protocol.
    In order to request to the equipment that responds with the measured value, the following command in hexadecimal is sent:  (02 78474B4FE20 03), obtaining like hexadecimal answer the following: (02 58474B4FE203220323038353030 03), in which it is included the measured value.
    I need to have the measurement from equipment in a PC, using the AK protocol and the serial port. For this, I have made a (vi) that it writes the read measure command in the serial port, wait a time (150ms) and read the port, this way everything works correctly, but there is a problem and it is that the communication is very slow due to the delay between the writing and the reading.
    If I eliminate the delay, the synchronization between the writing and the reading is lost, appearing readings of value 0. I think that is because the PC read the port and the analyser not yet has responded to the request from PC, and this happens in spite of using the options of synchronization of visa read and visa write vi's, (Do I/O synchronously).
    I would need to design a (vi) that hoped that the equipment had sent the last data, and then it sends the reading request again, being able this way to make the communication more fast and to eliminate the erroneous readings.
    I have attached two examples, first is (vi) that works well, but has the problem of being slow due to the delay, and the second analyzes the received message to know when this complete and then it writes another message of read to analyser, but it appears to me an error (ocurred AT sights read... Time out) after minutes.
    I would thank any aid that somebody could offer to me.
    Greetings and thanks!
    Attachments:
    Test_AK.zip ‏32 KB

    I don't have a serial port connected on this machine at the moment (they are becoming rare on laptops!) but try this code as a starting place. I notice in your second example you are basing the read on receiving a specific string, in the one I've made you can set the bytes at port compare to a number equivalent in length. I haven't tried it, as I mentioned before, so I appologize for any errors in my code.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Attachments:
    serial read.vi ‏67 KB

  • Serial port support

    Hi, does anyone know when AIR is going to support serial port connectivity? Or is there a link that shows upcoming features for the AIR roadmap?
    thanks

    Have you checked the widgets demos?
    Sincerely,
    Michael
    Sent from my iPhone
    El 09/07/2009, a las 12:10, sf_dougco <[email protected]> escribió:
    >
    Hi, does anyone know when AIR is going to support serial port 
    connectivity? Or is there a link that shows upcoming features for 
    the AIR roadmap?
    >
    thanks
    >

  • HP deskjet 710c and windows 7 64 bit serial port configuration

    Hi computer people,
    Please help, I can't get my Hp deskjet 710c to print with Windows 7 professional 64 bit computer via non usb i.e I am using the serial port connections via computer and printer. Any solutions as to why it won't print ?

    Hello PeterB91,
    Welcome to the HP Forums, I hope you enjoy your experience!
    I have read your post on how you are not able to  print on your Windows 7 computer, and I would be happy to assist you in this matter!
    Unfortunately, the only way to update the drivers for your printer on your computer is to connect the two devices with a USB cable. This will allow the installation of Plug-and-Play drivers. According to the Product Specifications for your printer, the only available connection-type is for the IEEE cable.
    As a workaround, you may be able to use a USB to IEEE adapter, but this option is not guaranteed. 
    I hope this helps!
    Best Regards  
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • Establish a connection with the serial port on ST2510

    Hello guys,
    I have one question about connection on ST2510 with the serial port.
    Is it possible to get the following command prompt during connection on ST2510 through serial port (as described in the document 820-0015-11):
    "Enter password to access shell:"
    instead of
    "Enter password to access Service Interface (60 sec timeout):"
    ?

    stapler wrote:
    Thanks a lot,
    ...and how is it possible to get "Enter password to access shell:" instead of "Enter password to access Service Interface (60 sec timeout):" (wrong cable connection, etc.)?
    I ask about it, because one guy said me, that he tried to establish a connection according to the document 820-0015-11.
    But instead of "Enter password to access Service Interface (60 sec timeout):" he has got "Enter password to access shell:" and the default password kra16wen is incorrect.I won't indicate how to get "Enter password to access shell" because this is a special access as indicated in my previous post. However in order to get "Enter password to access Service Interface (60 sec timeout):" you need to press "S" (capital S) within 5 sec and then the password is "kra16wen".

  • Why does a standalone program created in Labview 8.5 try connecting to the internet when the program only reads data through the serial port? Firewalls object to progams that contact the internet without permission.

    why does a standalone program created in Labview 8.5 try connecting to the internet when the program only reads data through the serial port? Firewalls object to progams that contact the internet without permission.
    The created program is not performing a command I have written when it tries to connect to the internet, it must be Labview that is doing it. How do I stop this from happening? 
    Any help would be very appreciated.

    It looks that way..
    "When LabVIEW starts it contacts the service
    locator to removes all services for itself. This request is triggering
    the firewall.This is done in case there were services that were not
    unregistered the last time LabVIEW executed- for example from VIs that
    didn't clean up after themselves"
    This is not yet fixed in LV2009.
    Message Edited by Ray.R on 11-04-2009 12:25 PM

  • 323 serial port through a USB connection on an iPad

    Does anyone know of an app that will drive a 323 serial port through a USB connection?  It must have universal application, not just for Cisco routers.

    you can download latest installer from here
    * getfirefox.com
    then you can install this to any pc or carry anywhere

  • Unable to establish serial connection between 2 serial ports of same laptop

    I am trying to run "Basic 2 port serial write and read.vi" from the labview example using the 2 different com ports of same laptop. My serial cable is fine. It has passed loopback test. Also I have successfully communicated with the microcontroller(via max232) using the same cable. Still In the given example, I am not recieving character that I have written in the "string to write" window. I have confirmed the com port numbers. The cable I am using is simple 3 wire tx-rx and ground cable. I have also tried to connect two ports on two different pc's that also doesnt work. What may be the problem? I can't see any.                 

    Are you changing the data being sent?  As currently configured, you need to make sure the \n stays at the end of the data.  To avoid this, turn the termination character off (input on the top of the Configure Serial Port, wire a FALSE constant to it).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for