This page is for general content regarding the use of rxtx. Feel free to add your own content.
I wrote an app several months ago using javax.comm on windows. Sun has left me high and dry. rxtx help!
Dido Sun left me Hi and dry. After 30+ hours wasting my life on javax.comm it is the RXTXcomm 2.1.7 that really worked the first time
REMEMBER !! for the newbies Change the all occurences of the import javax.comm.*; in MyApps.java TO import gnu.io.*; I did not even have to recompile as suggested the rxtxSerial.dll
a job well done for the rxtx.org team.
Even after following the above instructions, under Netbeans 5.5 on Windows, I needed to right-click Libraries under Projects on the left hand side of the screen, and select Add JAR/Folder, picking the RXTXcomm.jar file. Only then did my "import gnu.io.*;" become a valid command. Also, I got a run-time error where it failed to load the rxtxSerial.DLL library because it couldn't find it. I needed to right-click the project name, select properties, select Run under categories, and ...
add a VM Options: entry of -Djava.library.path="C:/where-ever-you-stuck-rxtxSerial.DLL-file;%PATH%" While I'm sure there is more than one way of adding the directory to your path, this worked for me. Note I did the default NetBeans 5.5/JDK 1.6.0 isntall accepting all the default options(ie clicking next until I got to finish), so I haven't modified my java paths or anything.
This is how I add and use RXTX in Eclipse for Win32 Projects, there are probably other ways but it works for me. mailto:[email protected]
Be careful when using System.in.read() and rxtx in win32; It can trip across a known JRE deadlock (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4809647 ) bug
Saving the RXTX jar-file and DLL in the JRE is not optimal if you indend to distribute your JAVA application and do not want to bundle it with a customized JRE.
For Windows, the Janel (http://sourceforge.net/projects/janel ) JAVA launcher can be used.
It should be possible to unjar the RXTXcomm.jar and then add the .classes into YourApp.jar. This should eliminate the secon .jar and the need to modify java.class.path. Please clarify the steps if you pursue this.
I was successful in doing this on my Mac. First, unzip the RXTX.jar file. I didn't try unjar, as unzip worked fine. Then, place the gnu folder in the same folder as your application jar file. Execute the following command from the command line:
jar uvf Your_Apps_Name_here.jar gnu
to update the jar with the contents of the classes in the gnu folder. Your app will now run by double clicking on it, provided the .dll or .jnilib library is in the same folder. I would love to include the OS specific libraries in the jar for a single, monolithic package, but after researching this on the web, it is apparently very difficult at best and probably impossible.
It would be great if someone with access to Linux boxes could provide us with similar recipes for their operating system.
The above unjar instructions and subsequent jars worked fine for my app on both Mac and Windows machines.
<!-- Saved in parser cache with key rxtxdb:pcache:idhash:945-1!1!0!1!0!1!0!!en and timestamp 20070424145924 -->