Reputation: 1447
Hello I have seen this Why am I getting a Java NoSuchPortException when the port exists? post but It's not very clear to me!!
In device manager it shows COM3 is exist and I can connect it through putty, but this piece of code is getting this error/exception.
try {
portId = CommPortIdentifier.getPortIdentifier("COM3");
} catch (NoSuchPortException ex) {
System.out.println(ex);
}
try {
serialPort = (SerialPort)portId.open("S2CFrameWork", 5000);
} catch (PortInUseException e) {
System.out.println(e);
}
this simple code thrown a javax.comm.NoSuchPortException, I have also tried this with using Enumeration to get the list of avilable port but still it shows exception. Can anyone solve this issue?
Upvotes: 2
Views: 14556
Reputation: 1447
%JAVA_HOME%/lib
%JAVA_HOME%/jre/lib/ext
%JAVA_HOME%/bin
%JAVA_HOME%/jre/bin
%windir%System32
%JAVA_HOME%/lib
%JAVA_HOME%/jre/lib
Upvotes: 6