使用javax.comm API的javaws应用程序在Linux x64上看不到环境变量
我有一个Java应用程序,它使用Serialio.jar和javax.comm API访问串行端口。从32位Java转换到64位带来了一些问题。示例代码与用于与串行/usb设备通信的代码类似:使用javax.comm API的javaws应用程序在Linux x64上看不到环境变量,java,Java,我有一个Java应用程序,它使用Serialio.jar和javax.comm API访问串行端口。从32位Java转换到64位带来了一些问题。示例代码与用于与串行/usb设备通信的代码类似: Enumeration portIdentifiers = javax.comm.CommPortIdentifier.getPortIdentifiers(); while (portIdentifiers.hasMoreElements()) { javax.comm.CommPortIden
Enumeration portIdentifiers = javax.comm.CommPortIdentifier.getPortIdentifiers();
while (portIdentifiers.hasMoreElements()) {
javax.comm.CommPortIdentifier pid = (javax.comm.CommPortIdentifier) portIdentifiers.nextElement();
System.out.println("name: " + pid.getName());
}
当我使用java运行此代码时,我必须添加-DSERIAL_PORT_LIST=/dev/ttyS1:/dev/ttyS1
命令行选项以公开串行端口列表。那很好
但是,当我使用命令行中的-J-DSERIAL_PORT_LIST=/dev/ttyS1:/dev/ttyS1
使用javaws运行此代码时,会出现以下错误:
getPortList: port discovery not currently supported on this platform.
Options:
A) addPortName can be used to build a list of device names
B) java -DSERIAL_PORT_LIST=COM1;COM2;COM3
or java -DSERIAL_PORT_LIST=/dev/ttyS0:/dev/ttyS1
到目前为止,使用addPortName函数会导致整个事件发生核心转储。有没有更简单的方法让javaws查看串行端口列表值?您是否尝试过使用JNLP文件传递JVM参数?我想这是您正在尝试启动的客户端应用程序。