Java Rxtx Usb Serial Drivers
Java supports communication to serial ports, but not with its default installation. It requires an installation of an external library.
Currently, two options exist for achieving serial communication: • • Unfortunately, the current version of JavaComm does not support Windows, and only supports Solaris SPARC, Solaris x86, and Linux x86. Since I use none of those operating systems, this article will only discuss how to install RXTX in Windows.
I am running the RXTX versions of the communication libraries since. This is the code that I wrote to set up the serial port using the setDTR function. Metal slug anthology.cso. Mac the drivers for the Silicon Labs USB / Serial bridge don't do this and. These examples assume that your system has serial ports available and configured or that you’ve got a USB-serial cable with drivers installed (Linux systems usually have many USB-serial cable drivers preinstalled), and that you know how to address your port(s), e.g., /dev/ttyUSB0.
UPDATE: 12 Sept 2011 – Thanks to a comment from Kurt Zoglmann, there are instructions on how to do this with a Mac! I never tried this myself because I don’t have a Mac, but the procedures stated there look good to me (see ). A 32 and 64 bit version of the library exists. I’ve updated this article from when it was first published to include the new locations for where to download the libraries, but I have not gone through the installation of the libraries again, so I’m not surprised if the rest of the content on this page is outdated too.
32-bit version: 64-bit version: To install the libraries (instructions from ): • • Copy rxtxSerial.dll to%JAVA_HOME%bin, (%JAVA_HOME% is the folder where JRE is installed on your system; e.g. C:Program FilesJavaj2re1.4.1_01) • Copy RXTXcomm.jar to%JAVA_HOME%libext Once installed, the IDE will need to know where to look for these installed files. Even though the files exist in the JRE directory, each project needs to know about these files. More information on. In order to start coding with this library, import gnu.io.*. For more information about Java Serial Programming, look. Happy coding!
There doesn’t seem to be a prebuilt 64bit library for OS X. This is a problem with Lion since it only comes with the 64bit version of Java 1.6.0_26.
To save someone some hassle download 2.2-pre2 from the official site. Install the free application, Xcode, from the App Store.
Then modify the configure script as follows: JAVAINCLUDEDIR=$JPATH/./././Headers Next run the configure script:./configure Finally install it by issuing the following command: sudo cp i386-apple-darwin11.0.0/librxtxSerial.jnilib /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Libraries. I was wrong about there not being a 32bit version of Java in OS X Lion. If you want to use a prebuilt 32bit version of RXTX, you will be able to find the prebuilt binary with a quick google. To enable the 32 bit version of Java by default, open the “Java Preferences” application found in /Applications/Utilities. Drag the 32bit version of Java to the top and exit the program. The default java on the command line will now be the desired version and it can be found at /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK.