In the code: CommPortIdentifier.getPortIdentifier(portname) is not able to indentify the ComPort.
{CommPortIdentifier cpi = null;
try {
cpi = CommPortIdentifier.getPortIdentifier(portname);
if (cpi.isCurrentlyOwned()) {
System.out.println("Error: Port is currently in use");
}
com = (SerialPort) cpi.open("COM", 10);
com.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
} catch (Exception e1) {
e1.printStackTrace();
return false;
}}
I have tried the solution in the link how-to-install-java-communications but failed, please help me regarding.