Java Rxtx Usb Serial Converter
/*------------------------------------------------------------------------- RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. How To Install Flip Down Dvd Player In Honda Odyssey on this page. RXTX is a native interface to serial ports in java. Copyright 1997-2012 by Trent Jarvi tjarvi@qbang.org and others who actually wrote it. See individual source files for more information. A copy of the LGPL v 2.1 may be found at on March 4th 2007.
A copy is here for your convenience. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. An executable that contains no derivative of any portion of RXTX, but is designed to work with RXTX by being dynamically linked with it, is considered a 'work that uses the Library' subject to the terms and conditions of the GNU Lesser General Public License. The following has been added to the RXTX License to remove any confusion about linking to RXTX. We want to allow in part what section 5, paragraph 2 of the LGPL does not permit in the special case of linking over a controlled interface.
Access serial ports in Java with CommAPI, RXTX and jSSC, USB IO Module, analog input, digital input, digital output, rtd input, relay module, relais modul. Hi, I have the following setup: PC USB-to-RS232 adaptor RS232 port on custom hardware I found this Java code for communicating over. Instead I used gnu.io, which is an opensource package provided by rxtx (wiki is at whilst their original.
Utsav on June 3rd, 2009, 07:29 Hi Sebastian, Thank you for your immediate response. Utsav on June 3rd, 2009, 14:18 Hello Sebastian, Sorry to write in again. Does this code require any specific system configuration for the ports to be detected? The scenario has turned like this. The code works fine on another laptop which is a Pentium 4 while my machine is a Pentium 3. Are there any values that i need to set for the ports in order for them to be detected?Or are the default values fine? Another thing is that I have a serial mouse connected to my Pentium3 machine and it is working fine.
So that implies that the COM port is active. But it is still not getting detected using the code. Norton Ghost 12 Dos Version 4. Awaiting your reply to both my posts.
Thanks again. Sid on June 4th, 2009, 06:52 Hey Thanks for the turorial.
I am running this on NetBeans 6.5. I put the dll and the jar in the JDK 1.5 package. I have created virtual ports COM1 and COM2 that were detected using the ListAvailable ports. I have created all the specidfied java files.
I clean build it and its successfull. But when I run it i get the following error. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Exception in thread 'main' gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at RS232Example.connect(RS232Example.java:13) at RS232Example.main(RS232Example.java:30) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds) All help is much appreciated. Thanks Sid • 16.
Utsav on June 4th, 2009, 13:12 Hi Sebastian, I downloaded the Serial Ports emulators and they work fine on the laptop. But again, the result is same on my machine, the Pentium 3. Also, when i tested the code on a Pentium 4 desktop, it did not work. I am really confused with the configurations here.I have tried and checked every possible value that i could check regarding the COM ports on approximately 5 different machines with two of them being Pentium4 desktops, and 3 being Pentium3 desktops. All of them match with the laptop.
But the only place where they differ is the successful output from the code. I am awaiting your email containing all the lib files and the gnu package as well. By the way, is it possible for you to come online, or give me your personal email id so that we both can have a chat, so that this issue can be sorted out. Awaiting the email and all the details required in the email. Kindly reply asap so that i can successfully execute the code. In anticipation of your reply. Utsav:( • 19.
On June 29th, 2009, 21:39 Hi Tim, The way how to open multiple serial ports in your application depends on your communication model. For example you can use multiple serial ports for sending bytes and receiving bytes simultaneously - then you should consider multithreaded architecture - one thread per writer and reader. If you send bytes to all devices sequently, then you should consider opening one thread for sending and multiple threads for receiving bytes. Please give me more details. Then maybe I could help.
Regards Sebastian • 28. Emre on April 23rd, 2010, 19:49 Finally, I got this output with win xp. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 COM3 But with 64 bit vista I get the same output. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Anyway, I work with veteran xp.
I soppose COM3 is modem port, but I use a rs232 to usb converter that you said. By the way, I want to comminicate with a point of sale that is verifone nurit 8400 Now, this pos is used like; Somebody has developed a software on NURIT_8400. It gets some inputs from the pin pad which is stored in date base that is in a simple laptop pc, and gives some outputs to its screen. (Pin pad is used by a human so the aim is passing on this job to a machine) Later, it is going to be used like; NURIT_8400 provides a rs232 port. I think the simplest way to comminicate with this pos is rs232.
I found a manuel that tells about the frame formats of NURIT_8400. I focused this reference these days.
Can you give me some hints, clues about these things that I mentioned? Am I on the right way? Anything is appreciated. On April 27th, 2010, 21:56 In your place I would go on this site: and find out is there any api (eg for java language) available for your unit. Crating native communication is tricky and generates errors.
Finally if you decide to create RS232 application, try to find emulator for nurit 8400 (on the site above, there are tools for this unit types, maybe there is a tool which simulates rs232 protocol). Make sure, your device sends something to you: launch terminal and verify connection with device. Finally write tests covering all needed operations and implement device protocol. If you want, I could send you some examples for different devices. Rules are same. Harry on May 18th, 2010, 00:29 Hi Sabastian, Apparently I set up the environment ok, however the dll's don't work with Windows 7 64-bit: java.lang.UnsatisfiedLinkError: C: Users BigBoss Workspace JavaSerial lib rxtxSerial.dll: Can't load IA 32-bit.dll on a AMD 64-bit platform thrown while loading gnu.io.RXTXCommDriver Exception in thread 'main' java.lang.UnsatisfiedLinkError: C: Users BigBoss Workspace JavaSerial lib rxtxSerial.dll: Can't load IA 32-bit.dll on a AMD 64-bit platform Do you know of any solution?
Shawn on January 11th, 2011, 10:17 Hello Sebastian: I have two problem: 1. I download the RXTX api from 'But the version is a mismatch.===>Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 2. I send the strings by the example and physical conecting two PC, but the reveiver(anther pc) receive the message is always lost some characters. Example: sender=>ABCDEFGHIJK receiver=>ABCDE@IJK8 Do you know of any solution? Shawn on January 12th, 2011, 10:09 Sebastian: 1.I think that the version mismatch is caused by the anther softwave (Matlab7.1).
The Matlab7.1 also have a rxtxSerial.dll in 'C: Program Files MATLAB71 bin win32'. Although I set the library to the rxtxSerial.dll in the netbeans, the netbeans still use the rxtxSerial.dll in MATLAB71. I try the solution in page 'But still failed. Do you know of any solution? The problem is OK now. It is hardwave problem.
Thanks a lot!! On February 14th, 2011, 22:14 @eljun If you use x64 based system, binaries from rxtx site won't work. X64 binares are available on site: but it seems to be a little outdated (2008). Code you have written should work on Windows Vista. Virtual Serial Port Driver supports boths operating systems.
I think the only concern you may have is finding base of an architecture of your system (32 or 64). Check it before development. Unfortunately, I do not have any tutorials for Parallel. BR Sebastian • 60. On February 15th, 2011, 04:04 Hi Sebastian, Great! My desktop is running in Windows Vista x86.
I am ok with that. Though my laptop is Windows 7 x64, so I have to spend more time remotely accessing my desktop for this.
Your code worked perfectly together with the Virtual Serial Port Driver (VSPD). Two thumbs up for that. It was flawless and the instructions were perfectly ordered. I am just stuck in one problem. I need to tap through the serial port wherein I would like to have a port (COM20) with a connection to a device (COM25) and a tapper (COM26), I cannot do this with the VSPD.
COM26 is restricted to connect to COM20 since COM20-COM25 connection has already been established. Here is the scenario: COM20: The receiver. This port is the default port within the system (a computer or workstation) COM25: The sender. A device that is working outside the computer. It receives instructions from COM20 and sends results once the instructions have been completed. COM26: The tapper. It listens to whatever COM25 has to send and does almost perfectly the same as COM20.
What do you think should I do? Thanks, Eljun • 61. Latha Karthigaa on February 15th, 2011, 05:22 Hi Sebestian! I am using Netbeans IDE 6.5.1 I have downloaded the zip file for rxtx from I have created a project named 'JavaSerial' and in the home directory of the JavaSerial project, I have created a new directory lib wherein I placed RXTXcomm.jar, rxtxSerial.dll and rxtxParallel.dll In the libraries tab, I added RXTXcomm.jar and clicked OK But I could not follow the instructions written under 'Extend project classpath' (I could not follow the Eclipse tutorial for NetBeans).
So the result is when I compile, I get the following errors. On February 17th, 2011, 04:08 Hello Sebastian, You have the right idea, but I missed some information a bit. I was not able to emphasize the scenario, that the sender (COM25) and receiver (COM20) are existing systems that should not be touched.
This means that COM25, as the sender, is: 1. Made to send data to its output regardless of whoever receives it.
Not to be changed or remodeled/recoded. Now, given the emphasis above, I am thinking of the pipe that you mentioned. How is this implemented?
Is this done programatically or with the use of additional hardware. Thanks, Eljun • 65.
On February 17th, 2011, 11:55 @eljun I think the best way you can solve your problem is to create MyProxy application which connects to the device (COM20 - COM25). Sa any flow of data is passing through your application and you can do anything you want with bytes. MyProxy COM20 -------- COM25 Your Device and COM20 ---- COM25 ->VSPD pair Next step is to create pair of com ports (COM26, COM27) for you tapper and connect it with MyProxy application: MyProxy COM26 ------- COM27 Tapper Shorty, if you receive data from COM20 you can send it using COM26 to tapper. You create something like data tunnel. On February 18th, 2011, 02:06 Hello Sebastian, That is great suggestion, a proxy might be my option, though I have not explored on creating a proxy, yet.
I do have another situation. - a running application (MyDesktopAppplication) in a desktop is directly linked and has ownership to port COM20 (receiver).
Acting somewhat like a controller sending control signals, dos and don'ts, to an external device, that is connected to COM25 (the sender of processed information). - COM25 is connected (externally) to a machine/anything that processes something whose results are outputted to it and received by COM20. How do you think a proxy or a tapper is done here? Thanks, Eljun • 67. On February 19th, 2011, 01:01 @Eljun I see what you mean, this is kind of circular dependency?
COM25 DEVICE COM20 MyDesktopApplication COM25 Am I right? If so, you need two more physical com ports (eg. COM21,COM22) to connect with COM20 using DB9-DB9 cable and then with device. COM25 DEVICE COM22 MyProxy COM21 COM20 MyDesktopApplication COM25 As you see everything you send using COM20 is passed to COM21 connected with proxy. Proxy sends data to the device connected with COM22. Proxy could also distribute data with your expectations.
If you don't have additional com ports, use usb ports and usb-com adapters. Create/buy simple port multiplier, for example: (take a look on example case in pdf document).
On February 24th, 2011, 02:04 Hi Sebastian, I was away for a short while. It is very good to hear from you. I still have to learn more about circular dependency. I like the illustration and I would want to do the same. Please see below. The existing system is this.
MyDesktopApplication COM20 COM25 External Device Descriptions: MyDesktopApplication - an application that is running and has ownership to COM20. COM20 - COM20 is the port within the computer/desktop/laptop - Serial port of the Computer/desktop/laptop COM25 - (dummy port name) externally connected to - Serial port of the external electronic device External Device - an electronic device with a serial port (COM25) that is connected serially to a computer/desktop/laptop.
MyWantedApplication is an application that would listen to the activities (inputs/instreams) at port COM20 Thanks, Eljun • 70.