64 位 Windows 上的 Javax.comm API

发布于 2024-09-28 03:08:51 字数 211 浏览 1 评论 0 原文

我正在使用 javax.comm API 来帮助我的程序通过串行端口与硬件进行通信。我使用的是 Windows 7 和 NetBeans IDE 9。

我使用常见的 Java 程序来检查 PC 上的可用端口。程序编译并运行没有错误。然而它什么也没返回。

如何在 Windows 上使用 javax.comm API? win32com.dll 似乎不适用于 64 位操作系统。

I am using the javax.comm API to help my program communicate with hardware over serial port. I am using the Windows 7 and NetBeans IDE 9.

I used the common Java program to check the available ports on my PC. The program compiled and ran without error. However it returned nothing.

What can I do to use the javax.comm API on Windows? It seems win32com.dll does not work with a 64-bit operating system.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

单身情人 2024-10-05 03:08:51

这就是我让它工作的方法。
我已经在我的 Windows 7 64 位机器上使用 JDK 1.6(32 位)对其进行了测试。

  1. 安装 32 位 JDK。
  2. 将“win32com.dll”复制到 JDK_HOME\jre\bin。
  3. 将“javax.comm.properties”复制到 JDK_HOME\jre\lib。
  4. 将“comm.jar”复制到 JDK_HOME\jre\lib\ext。

现在运行你的程序,它应该可以工作。

This is how I got it to work.
I've tested it using JDK 1.6 (32bit) on my Windows 7 64bit machine.

  1. Install 32bit JDK.
  2. Copy 'win32com.dll' to JDK_HOME\jre\bin.
  3. Copy 'javax.comm.properties'to to JDK_HOME\jre\lib.
  4. Copy 'comm.jar'to to JDK_HOME\jre\lib\ext.

Now run your program and it should work.

天邊彩虹 2024-10-05 03:08:51

RXTX 的最新 2.2pre 版本包括 64 位 Windows 的二进制文件。我认为最新的RXTX信息源已更改为:http://rxtx.qbang.org< /a> 而不是 http://www.rxtx.org

RXTX 库一度包含对使用 javax.comm api 的直接支持。我不确定它是否仍然如此,但使用“本机”RXTX 包装的主要变化主要只是包名称的更改。

Recent 2.2pre versions of RXTX include binaries for 64-bit windows. I think the latest RXTX information source has changed to this: http://rxtx.qbang.org instead of http://www.rxtx.org though.

At one point the RXTX library included drop-in support for using the javax.comm api. I'm not sure if it still does, but the main change then to use the "native" RXTX packaging was primarily just a package name change.

注定孤独终老 2024-10-05 03:08:51

win32com.dll 似乎不适用于 64 位操作系统

我认为这是正确的。事实上,根据相关下载页面,Oracle 不再支持任何 Windows 平台的javax.comm API。

但是,我发现 此页面 有 64 位版本的 DLL,其中其他事情。

编辑

通过一项令人震惊的研究(即跟随链接并阅读内容),我找到了,声称拥有适用于各种平台的二进制文件。如果您的平台不存在,请尝试从源代码构建。如果这不起作用,请考虑投入精力使其发挥作用。

it seem the win32com.dll does not work with 64-bit Operating system

I think that is correct. In fact, according to the relevant download page, Oracle no longer supports the javax.comm API for any Windows platform.

However, I found this page which has a 64bit build of the DLL, among other things.

EDIT

By an astounding piece of research (i.e. following the links and reading stuff) I found the download page for the latest RXTX, which claims to have binaries for various platforms. If your platform is not there, try building from source. If that doesn't work, consider investing the effort in making it work.

黎夕旧梦 2024-10-05 03:08:51

我已将 RXTX 库集成到我的一些早期项目中,并且在 Windows 下使用通信端口时发现了这个错误,因此您可能需要在进行一些严肃的应用程序设计之前先检查一下这一点。
通信工作正常,从来没有任何问题,但是一旦打开端口,您就无法关闭它并重新打开,如果您使用提供的关闭端口的方法,您的应用程序就会挂起,无一例外。后来我发现网络上用户描述的行为相同,但从未真正找到解决此问题的方法。
同样,这可能会帮助您节省一些时间,请先检查一下。

最新版本,这是 http://rxtx.qbang .org/pub/rxtx/rxtx-2.1-7-bins-r2.zip,不再有这个问题。不幸的是,我认为它仅适用于 Windows,它仍然存在于 Linux 二进制文件中,而且我还没有在 Mac 上尝试过。

I've integrated RXTX libraries into some of my earlier projects and i found out this bug it has while working with comm ports under windows, so you might want to check this first before going into some serious app design.
Communication works fine, never had any problem with that, but once you open the port you cannot close it and reopen, if you use method provided for closing port, your app just hangs, no exception no nothing. I found later the same behavior described by users on web, but never really found the solution to this problem.
Again, this might help you save some time, check it first.

Latest release, which is this http://rxtx.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip, doesn't have this issue no more. Unfortunately i think its solved only for windows, its still there on Linux binaries, and i haven't tried it on mac.

樱桃奶球 2024-10-05 03:08:51

你看过 RXTX 吗?我认为它仍然活跃。

Have you got a look on RXTX ? I think it is still active.

轻拂→两袖风尘 2024-10-05 03:08:51

我遇到了这个问题...在 64 位机器上...运行 Windows 7,

一个用 jdk 1.4 开发的遗留应用程序,适用于 32 位 Windows...并使用 win32 comm api 二进制文件,

我尝试了 64 位的 RXTX 二进制文件,我是能够在某种程度上与我的设备进行通信...但是...还有其他问题,因为我的应用程序引用了内部使用 comm-api 的 jpos 库版本(已导入 javax.comm.*...一些 Serial...Listener 类)....

我安装了 32 位 jdk 并按照此处的指示为 32 位 Windows 设置了 comm-api 二进制文件...在 Windows 上设置 comm api

之后一切都很好

I had this issue...on a 64 bit machine..running windows 7

a legacy application developed in jdk 1.4, for 32 bit windows... and using the win32 comm api binary

i tried the RXTX binary for 64 bit and i was able to communicate with my device on some level... but... there were other problems as my application referenced a version of the jpos library that internally was using the comm-api (had import javax.comm.*... in some Serial...Listener class)....

I installed a 32 bit jdk and setup the comm-api binaries for 32 bit windows as directed here...setup comm api on windows

all was fine afterwards

泪痕残 2024-10-05 03:08:51

您可能对我编写的另一个库感兴趣:http://code.google.com/p /j外设/

You might be interested at an alternative library I've authored: http://code.google.com/p/jperipheral/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文