Javax.comm API on 64-bit Windows

别来无恙 提交于 2019-11-26 16:29:00

问题


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.


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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




回答6:


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




回答7:


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



来源:https://stackoverflow.com/questions/3959743/javax-comm-api-on-64-bit-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!