title: Automatically detect which Com Port is connected to a USB GSM Modem using Java
body: <p>I wrote a Java application that reads and sends SMS messages from a USB GSM modem. I'm using SMSLib (which uses JavaCommAPI), and it runs on Windows. I need to pass in the COM PORT, that the modem appears to be connected to. </p>
  
  <p>So far, I've been looking up the COM PORT manually using the Windows Device Manager, and write it into a properties file. I'm wondering if there's a way to detect which COM PORT, the modem is connected to programmatically? </p>
  
  <ol>
  <li>It'll save the trouble of looking it up every time</li>
  <li>The port number changes if I unplug/replug it sometimes</li>
  </ol>
  
  <p>Thanks!!</p>