1
I am doing a project in Java using the jSSC library, but when I use the method of listing the ports nothing appears. I tested on another computer and worked perfectly, but on my personal computer does not work.
I’ve seen videos of how to activate the COM port, but none worked when using the method.
String[] portNames = SerialPortList.getPortNames();
for(int i = 0; i < portNames.length; i++){
System.out.println(portNames[i]);
}
When I run the code below it does not pass the Serial.openPort()
.
Note: I used "COM1"
because through research I discovered that it is the standard port of W10.
Serial = new SerialPort("COM1");
try {
Serial.openPort();
}
catch (SerialPortException e) {
System.out.println(e);
}
Error:
jssc.SerialPortException: Port name - COM1; Method name - openPort(); Exception type - Port not found.
Which library is indicated to communicate with USB ports?
– CypherPotato
@Cypherpotato as far as I know java does not have an official API library for USB, but there are some independent alternatives like usb4java
– Murilo Portugal
Yes, it is connected to COM1 port in Device Manager
– Luan
@Luan could give more details about the project? Which device are you trying to communicate? Which output when you have list the doors with the command
SerialPortList.getPortNames();
? Which version of the JSSC lib you are using?– Murilo Portugal