1
我有一些代码可以在Windows 7中工作,但是当我在Windows 10机器上尝试相同的代码时,程序关闭。这里的代码:CommPortIdentifier.getPortIdentifier()崩溃程序
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());
}
}
没有例外被捕获,它只是关闭。我尝试了不同版本的Eclipse(32/64位),并在网上无处不在,但无法找到解决方案。任何想法为什么这可能会发生? Serialio.jar(我认为可以处理这个问题?)显然与Windows 10兼容。
当它关闭下来,我得到这个错误:
... javaw.exe的
也有这个东西在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
嗯?你确定你是在正确的线程alfasin?那个是从哪里来的? – user2726536
关于这个问题的任何想法? :/ – user2726536