Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Using RxTx Libararies

I am new to Java , and trying to write a serial communication application.

I am using Windows 7 (32 bit)

D:\Glaswegian\Java\RXTX\Test>java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode, sharing)

D:\Glaswegian\Java\RXTX\Test>



D:\Glaswegian\Java\RXTX\Test>javac -version
javac 1.7.0_07

D:\Glaswegian\Java\RXTX\Test>PATH
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C
:\Program Files\MATLAB\R2009a\bin;C:\Program Files\MATLAB\R2009a\bin\win32;C:\Pr
ogram Files\Java\jdk1.7.0_07\bin;C:\Program Files\Java\jre7\bin;C:\Program Files
\Java\jre7\lib\ext

D:\Glaswegian\Java\RXTX\Test>

I downloaded the RxTx

http://henrypoon.wordpress.com/2010/12/25/installing-rxtx-for-serial-communication-with-java/ http://rxtx.qbang.org/wiki/index.php/Using_RXTX

As mentioned in above link, unzipped rxtx-2.1-7-bins-r2. copied rxtxSerial.dll to C:\Program Files\Java\jre7\bin copied RXTXcomm.jar to C:\Program Files\Java\jre7\lib\ext

I am just trying to run this code:

import gnu.io.*;

public class RxTxComm{
    public static void main(String[] args)
    {}

    }

I am getting below Error.

D:\Glaswegian\Java\RXTX\Test>dir
 Volume in drive D has no label.
 Volume Serial Number is C643-EE74

 Directory of D:\Glaswegian\Java\RXTX\Test

07/02/2013  18:09    <DIR>          .
07/02/2013  18:09    <DIR>          ..
07/02/2013  17:45                94 RxTxComm.java
               1 File(s)             94 bytes
               2 Dir(s)  82,430,877,696 bytes free

D:\Glaswegian\Java\RXTX\Test>javac RxTxComm.java
RxTxComm.java:1: error: package gnu.io does not exist
import gnu.io.*;
^
1 error

D:\Glaswegian\Java\RXTX\Test>

Referred this as well: javac -classpath not doing the trick

What is wrong?

like image 373
Gaurav K Avatar asked Feb 07 '13 12:02

Gaurav K


People also ask

What is RXTX in Java?

RXTX is a Java native library providing serial and parallel communication for the Java Development Toolkit (JDK). RXTX is licensed under the GNU LGPL license as well as these binary distributions. RXTX is a great package, but it was lacking pre-built binaries for x64 (64-bit) versions of Windows.


1 Answers

I guess I copied to the wrong folder. I resolved this issue like this:

  • copied rxtxSerial.dll to C:\Program Files\Java\jdk1.7.0_07\jre\bin
  • copied RXTXcomm.jar to C:\Program Files\Java\jdk1.7.0_07\jre\lib\ext
like image 113
Gaurav K Avatar answered Sep 19 '22 02:09

Gaurav K