是否有用于访问串行端口的 Java 库或框架?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/747539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there Java library or framework for accessing Serial ports?
提问by Azder
Is there a java library or framework (other than the javax.comm provided by Sun) that is easy to use when accessing serial and parallel ports ( especially RS-232 ). I need something free that will work both on Windows and Linux.
是否有在访问串行和并行端口(尤其是 RS-232 )时易于使用的 Java 库或框架(Sun 提供的 javax.comm 除外)。我需要一些可以在 Windows 和 Linux 上运行的免费软件。
采纳答案by Pierre-Luc Simard
As andri pointed out RXTXis pretty much your best choice. There is an article on getting started with RXTX on Windows here(relating to RXTX 2.1).
正如安德里指出的那样,RXTX几乎是您的最佳选择。这里有一篇关于在 Windows上开始使用 RXTX的文章(与 RXTX 2.1 相关)。
回答by Jason S
rxtx as the other posters have said. I've been using it and it works nicely. There is a problem if using nonstandard highspeed baudrates (multiples of 115200 e.g. 230400, 921600 are OK, but 1MB is not even if the hardware & underlying OS supports it), I've been told this will be corrected in rxtx 2.2.
rxtx 正如其他海报所说。我一直在使用它,而且效果很好。如果使用非标准高速波特率(115200 的倍数,例如 230400、921600 可以,但即使硬件和底层操作系统支持 1MB 也不是)会出现问题,我被告知这将在 rxtx 2.2 中得到纠正。
回答by Chris Winters
If free isn't necessary -- remember, your time isn't free -- then Serial IO SerialPortmight be useful. It's the only thing I found that works as-is on all of the following:
如果不需要免费——记住,你的时间不是免费的——那么Serial IO SerialPort可能会有用。这是我发现的唯一可以在以下所有方面正常工作的东西:
- 32/64-bit Windows
- 64-bit Solaris (didn't test 32-bit)
- 32 bit Linux (didn't test 64-bit)
- Mac OS X
- 32/64 位 Windows
- 64 位 Solaris(未测试 32 位)
- 32 位 Linux(未测试 64 位)
- Mac OS X
You do get source with the product, albeit with some weird and annoying build practices.
尽管有一些奇怪和烦人的构建实践,但您确实获得了产品的源代码。
FWIW, I'm just a contented user, not affiliated with the company.
FWIW,我只是一个满足的用户,与公司无关。