How to Communicating between a J2ME Midlet and PC?


How do I make a J2ME Midlet to communicate with a java program or some application on the pc through the cable connected?


Incredible_Honk is almost right. The key is to use the (standard) system property "microedition.commports". This provides a comma delimited list of the com ports which are available to your application. To open a connection use CommConnection as follows:

CommConnection con = (CommConnection) Connector.open("com:<commport name>");

Usually this will provide access to a USB serial connection, possibly also infrared if available. Iterate through each one to see which one corresponds to the connection you're looking for.

On Windows at least, you will need to install the correct drivers for your handset first. This will then allow you to open a serial connection and communicate with the application.


There is no general way of doing this. It hardly depends on the capabilities of the mobil. Might be that there is some vendor API giving you special access to USB, but I'm not aware of any.

Some phones support communication via serial port connections. Take a look at the <a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/io/CommConnection.html" rel="nofollow">javax.microedition.io.CommConnection</a> interface for more information.


Sonyericsson phones offer a way to debug your midlet on the device and get the console messages back through the cable.


  • Joomla - how to add abutton upload file to parameter of template and do upload file?
  • MongoDB find on all properties of document
  • Getting configurable product options pre selected from the layered navigation
  • Check online status, for example by pinging
  • Smartly deal with Option[T] in Scala
  • Terminfo smkx and Application Cursor Keys vs Application keypad
  • REST: what's the name for the HTTP verb and endpoint?
  • How to SET IDENTITY_INSERT ON in SQL Server 2008 for multiple tables at once
  • Android NFC: enable and disable the NFC detected sounds
  • Biometrics device ping becoming failed after sometime
  • Low impact encryption formula for ROBLOX Lua
  • send arraylist as parameter in volley request
  • Vertica: how can you concate values by some order?
  • Use entered URL and button to display image from URL
  • What to do after getting Auth Token - Android Youtube API
  • Get a class as javax.lang.model.element.Element in junit tests
  • java: reading large file with charset
  • get list of all triggers,functions and stored procedures
  • Selenium - how to switch to a different (login) window that is brought up?
  • How do I get the standard Vim FTP command to work?
  • Semi-local Levenshtein distance
  • Java 11 and E(fx)clipse JavaFX plugin on Eclipse 4.9: An error has occurred - see the log file
  • Generate a runnable jar and include libraries in it with Maven
  • Unity Resources.load() won't work with external dll
  • how to add dashed border on highcharts “area” graph for every point
  • Run a form (insert/update/delete) from within a div using jquery
  • How to use Typescript with libraries like Ampersand.js that parse configs to build prototypes
  • How to use array in autohotkey?
  • How to redirect into different page by user type in php and mysql
  • Wireshark Display Filter for Unique Source/Destination IP and Protocol
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Neo4j…how to get a visual representation of my data?
  • Support of :after in IE7
  • Cloud Code: Creating a Parse.File from URL
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Background transfer download task failed when app was closed
  • ssh remote server login script
  • Can someone explain this Java code (formatting the output using System.out.format) to me?
  • What does the “id” field in an Android “Google Play Music” broadcast intent correspond to?
  • XSLT Transformation to validate rules in XML document