I'm trying to implement the transfering data with the help of Com ports in my java application. Firstly I decided to create SerialPort object like this.
SerialPort serialPort = new SerialPort("COM1");
try {
serialPort.openPort();
} catch (SerialPortException ex) {
ex.printStackTrace();
}
However there was an jssc.SerialPortException: Port name - COM1; Method name - openPort(); Exception type - Port not found.
Then I tried to determine, what com ports do I have:
String[] portNames = SerialPortList.getPortNames();
for (int i = 0; i < portNames.length; i++) {
System.out.println(portNames[i]);
}
The result was deplorable: portNames was empty.
Would you please advice me something.
There are various ways to handle this.