CommPortIdentifier.getPortIdentifiers is empty
问题 I am building a simple application that communicates through Serial Port using the Java Communication API javax.comm. Here is some code in my java main method I wrote: CommPortIdentifier cpi = null; Enumeration e = CommPortIdentifier.getPortIdentifiers(); while (e.hasMoreElements()) { try { cpi = (CommPortIdentifier) e.nextElement(); } catch (NoSuchElementException n) { } System.out.println(cpi.getName()); } Enumeration e is always empty even though I am connected to a COM 4 port when running