I am creating a simple application that communicates via a serial port using the Java Communication API javax.comm.
Here is some code in my main java method that 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());
}
Listing e is always empty, even if I am connected to the COM port when doing this.
also by running this code:
portRead = CommPortIdentifier.getPortIdentifier("COM8");
trigger a throw NoSuchPortException
I think I did the part of the installation correctly and placed the properties file, the win32com.dll file in the right places.
Do you know what the problem may be?
thank
source
share