问题描述
我们利用了一个Java应用程序,该应用程序通过串行端口管理密码键盘.可以在Windows上与Sun Comm.jar,提供的dll和属性文件完美配合.
We make use of a java application that manages a pinpad via the serial port.This works perfectly on windows with the Sun Comm.jar, the supplied dll and the properties file.
现在,我们正在尝试在Linux上使用此解决方案(实际上,它确实可以在现场使用的其他各种linux操作系统上运行)-Ubuntu服务器模式.
Now we are attempting to use this solution on Linux (actually it does run on various other flavours of linux out in the field) - with Ubuntu server mode.
经过多次尝试-流血,流汗和几乎流泪,我们遇到了这种情况:
After much attempts - blood, sweat and almost tears we have this scenario:
Java版本1.4.2_17Linux-UbuntuComm libs-由Sun提供的Comm3,具有指定的默认驱动程序
Java version 1.4.2_17Linux - UbuntuComm libs - Comm3 supplied by sun with the default driver specified
外部通讯测试显示通讯端口:/dev/ttyS0和/dev/ttyS1但是Java应用程序说无法打开端口/dev/ttyS1
An external comm test shows the comm ports: /dev/ttyS0 and /dev/ttyS1But the java application says unable to open port /dev/ttyS1
(使用RXRT文件会产生无效的端口错误)
(using the RXRT files produces invalid port errors)
有人能够在Linux上使用Java 1.4.2进行串行端口通信,并且找到了可以在我的方案中应用的解决方案吗?
Has anyone been able to use java 1.4.2 on linux for serial port communication and found a solution that I could apply in my scenario?
非常感谢
寒冷
推荐答案
我知道这是一个老问题,但是我创建了一个Java程序包和本机库来允许串行端口读写,目前仅处于同步模式.
I know this is an old question but I have created a Java package and native library to allow serial port read and write, currently in synchronous mode only.
它是开源的,可在GitHub上获得:
It's open source and available on GitHub:
j232 -Java源代码
libj232 -j232的本机库.
libj232 - j232's native library.
Wiki页面位于此处.
请注意,这是仅Linux的软件包和库.
Note this is a Linux only package and library.
这篇关于如何使Java在Linux中使用串行端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!