Java Serial I/O in Windows x64 using JRE x86
I have a Java application running on Windows 7 64-bit, but running on a 32-bit version of JRE. I need this application to communicate with a serial com port, and apparently I need a little help. :)
Before you suggest RXTX, I've already tried it, both with 32- and 64-bit versions of the RXTX DLLs. Either it fails because 32-bit JRE can't load a 64-bit DLL, or it fails because the 32-bit DLL gives an java.lang.UnsatisfiedLinkError:
java.lang.UnsatisfiedLinkError: <Path>\cache\bundle1030\version0.0\bundle.jar-lib\0\lib\win32\rxtxSerial.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(N开发者_StackOverflowative Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
which I assume is because the 32-bit RXTX DLL can't find a 32-bit DLL in Windows to use for serial communication.
Any clues for how to proceed? Another library? How to bridge the gap between 32-bit JRE and 64-bit Windows DLLs?
There is an amazing free tool called Dependency Walker. It tells you precisely what other DLLs a given DLL will load based on the current PATH, and which ones can't be found, or won't load correctly. It has saved my bacon many times, and it should be the perfect tool for debugging your problem here. Once you know what's missing you may be able to find 32-bit versions to install -- or maybe just alter your path to make them available.
精彩评论