How to use javax.comm API on Windows 7 64-bit with Java
How to use javax.comm API on Windows 7 64-bit with Java
The javax.comm API is a Java library that allows communication with hardware devices over serial ports. However, Oracle no longer supports this API for any Windows platform, and the win32com.dll file that is required for this API does not work with 64-bit operating systems. This article will show you how to use the javax.comm API on Windows 7 64-bit with Java.
Windows 7 java win64com.dll
Download File: https://www.google.com/url?q=https%3A%2F%2Furloso.com%2F2tKuhK&sa=D&sntz=1&usg=AOvVaw12Ugv_Ml9zPsZU6nzSPiBw
Option 1: Use a 32-bit JDK
One way to use the javax.comm API on Windows 7 64-bit is to install a 32-bit JDK instead of a 64-bit one. This way, you can use the win32com.dll file that comes with the API. To do this, follow these steps:
Download and install a 32-bit JDK from here.
Copy the win32com.dll file from the javax.comm API package to JDK_HOME\jre\bin.
Copy the javax.comm.properties file from the javax.comm API package to JDK_HOME\jre\lib.
Copy the comm.jar file from the javax.comm API package to JDK_HOME\jre\lib\ext.
Run your Java program that uses the javax.comm API and it should work.
Option 2: Use RXTX library
Another way to use the javax.comm API on Windows 7 64-bit is to use a third-party library called RXTX, which is an open source implementation of the Java Communications API. RXTX includes binaries for 64-bit Windows and supports most of the features of the javax.comm API. To do this, follow these steps:
Download and install a 64-bit JDK from here.
Download and install RXTX from here.
Copy the rxtxSerial.dll file from the RXTX package to JDK_HOME\jre\bin.
Copy the RXTXcomm.jar file from the RXTX package to JDK_HOME\jre\lib\ext.
Change your Java program that uses the javax.comm API to import gnu.io.* instead of javax.comm.*.
Run your Java program that uses the RXTX library and it should work.
Conclusion
In this article, we have seen two options to use the javax.comm API on Windows 7 64-bit with Java. The first option is to use a 32-bit JDK and the win32com.dll file that comes with the API. The second option is to use a third-party library called RXTX that supports most of the features of the API. Both options have their advantages and disadvantages, so you can choose the one that suits your needs best.
Option 3: Use JSerialComm library
A third way to use the javax.comm API on Windows 7 64-bit is to use another third-party library called JSerialComm, which is a cross-platform library that provides access to serial ports in Java. JSerialComm does not require any native libraries or installation, and it supports both 32-bit and 64-bit Java. To do this, follow these steps:
Download and install a JDK from here.
Download JSerialComm from here.
Add the jSerialComm.jar file from the JSerialComm package to your Java project classpath.
Use the com.fazecast.jSerialComm.SerialPort class to access serial ports in your Java program.
Run your Java program that uses the JSerialComm library and it should work.
Option 4: Use Java Native Access (JNA)
A fourth way to use the javax.comm API on Windows 7 64-bit is to use Java Native Access (JNA), which is a framework that allows Java programs to call native functions from any shared library without writing any native code. JNA can be used to access the Windows API functions that deal with serial ports, such as CreateFile, ReadFile, WriteFile, etc. To do this, follow these steps:
Download and install a JDK from here.
Download JNA from here.
Add the jna.jar and jna-platform.jar files from the JNA package to your Java project classpath.
Create a Java interface that extends com.sun.jna.Library and declares the native functions that you want to use from the Windows API.
Use the com.sun.jna.Native.loadLibrary method to load the kernel32.dll library and get an instance of your interface.
Use the methods of your interface to call the native functions from the Windows API in your Java program.
Run your Java program that uses JNA and it should work.
Comparison of options
In this article, we have seen four options to use the javax.comm API on Windows 7 64-bit with Java. Each option has its pros and cons, which we will summarize in this table:
Option Pros Cons
--------------------
32-bit JDK Easy to use Requires a 32-bit JDK
RXTX Supports most features of javax.comm Requires native libraries
JSerialComm Cross-platform and no installation May not support some advanced features
JNA Direct access to Windows API Requires knowledge of native functions
You can choose the option that best suits your needs and preferences based on this comparison. e0e6b7cb5c
- +