I have some code that works in Windows 7 but when I try the same code on a Windows 10 machine the program closes down. Here's the code:
try {
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier((String)openParameters[0]);
this._serCommPort = (SerialPort) portId.open("PTxCore", 1000);
this._serCommPort.setSerialPortParams((int)openParameters[1], (int)openParameters[2], SerialPort.STOPBITS_1, (int)openParameters[3]);
this._serCommPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
this._serCommPort.addEventListener(this);
this._serCommPort.notifyOnDataAvailable(true);
this._commsOutStream = this._serCommPort.getOutputStream();
this._commsInStream = this._serCommPort.getInputStream();
this.clearBuffer();
this.onTraceEvent(TraceEventArgs.Mode.Hidden, "{Open}");
}
catch (UnsupportedCommOperationException | TooManyListenersException | IOException | PortInUseException | NoSuchPortException ex) {
throw new PTxCoreException(ex.getMessage(), ex.getClass().getName());
}
}
No exception is caught, it simply closes down. I tried different versions of Eclipse (32/64 bit) and looked everywhere on the web but can't find a solution. Any any idea why this might be happening? Serialio.jar (which I think handles this?) is compatible with Windows 10, apparently.
When it closes down I get this error:
...javaw.exe
Also there's this stuff at the bottom of Eclipse:
javax.comm.SerialPort implementation: version 3.8
Copyright (c) 1998-2009 Serialio.com, All Rights Reserved.
Serialio Library: version 10.1.2: build 9221
Copyright (c) 1996-2012 Serialio.com, All Rights Reserved.
os.name="Windows 10" os.arch="x86"
osName=Windows 10 osArch=x86
Platform not supported, check VM properties os.name & os.arch
Its a bit of a late response but it might help someone. I was getting the same error. This was because I was using older version of Serialio.jar. After upgrading it to latest one (I think build: 9233 ?) it started running fine on Windows 10.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.