• Post Reply Bookmark Topic Watch Topic
  • New Topic

comm api not refreshing device manager  RSS feed

M Massa
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran into a problem using the Java comm api running on Windows where information from the Windows device manager is not being refreshed in the Java code. For example, we have a port, COM5, that is a USB to serial converter. This port only exists if the USB device is plugged in. If we do not have the device plugged in and run the following code:

We get a NoSuchPortException thrown, which is what we expect. However, if we then plug in the device so the port now exits and run the same line of code we get the same exception. It seems as if the getPortIdentifier method does not see the updated device list. The only way we are able to get this to execute successfully is to kill the JVM and start it again.

If the port exists the first time CommPortIdentifier.getPortIdentifier("COM5"); is called, then it works, but it cannot update dynamically.

Does anyone have any idea why this is or how to get around it?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!