Jump to content

biblioteca RXTX - não compila


Oxigen_cult
 Share

Recommended Posts

boa noite!

estava a tentar seguir o seguinte tutorial: http://www.arduino.cc/playground/Interfacing/Java

tentei compilar e deu-me os seguintes erros:

C:\Users\...>javac SerialTest.
java
SerialTest.java:3: package gnu.io does not exist
import gnu.io.CommPortIdentifier;
             ^
SerialTest.java:4: package gnu.io does not exist
import gnu.io.SerialPort;
             ^
SerialTest.java:5: package gnu.io does not exist
import gnu.io.SerialPortEvent;
             ^
SerialTest.java:6: package gnu.io does not exist
import gnu.io.SerialPortEventListener;
             ^
SerialTest.java:9: cannot find symbol
symbol: class SerialPortEventListener
public class SerialTest implements SerialPortEventListener {
                                   ^
SerialTest.java:10: cannot find symbol
symbol  : class SerialPort
location: class SerialTest
        SerialPort serialPort;
        ^
SerialTest.java:83: cannot find symbol
symbol  : class SerialPortEvent
location: class SerialTest
        public synchronized void serialEvent(SerialPortEvent oEvent) {
                                             ^
SerialTest.java:27: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                CommPortIdentifier portId = null;
                ^
SerialTest.java:28: cannot find symbol
symbol  : variable CommPortIdentifier
location: class SerialTest
                Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
                                       ^
SerialTest.java:32: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                        CommPortIdentifier currPortId = (CommPortIdentifier) por
tEnum.nextElement();
                        ^
SerialTest.java:32: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                        CommPortIdentifier currPortId = (CommPortIdentifier) por
tEnum.nextElement();
                                                         ^
SerialTest.java:48: cannot find symbol
symbol  : class SerialPort
location: class SerialTest
                        serialPort = (SerialPort) portId.open(this.getClass().ge
tName(),
                                      ^
SerialTest.java:53: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.DATABITS_8,
                                        ^
SerialTest.java:54: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.STOPBITS_1,
                                        ^
SerialTest.java:55: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.PARITY_NONE);
                                        ^
SerialTest.java:84: cannot find symbol
symbol  : variable SerialPortEvent
location: class SerialTest
                if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
                                             ^
16 errors

C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\com.java>

após isto fiz o download da biblioteca, copiei os ficheiros para as respectivas pastas (.jar para a pasta lib, e os .dll para a pasta bin), tentei de quase todas as maneiras imagináveis, e o problema persiste!

entretanto foi a procura de uma forma de importar as bibliotecas manualmente e encontrei este site: http://www.captain.at/howto-java-serial-port-javax-comm-rxtx.php

fiz uma outra pasta com o nome lib onde coloquei os ficheiros da biblioteca. e tentei compilar usando:

javac -extdirs lib nulltest.java (exemplo do site) e o antigo programa mas continua a dar erros:


Microsoft Windows [Versão 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Oxigen_cult>cd C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\co
m.java

C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\com.java>javac -extdirs li
b nulltext.java
nulltext.java:7: class nulltest is public, should be declared in a file named nu
lltest.java
public class nulltest implements Runnable, SerialPortEventListener {
       ^
nulltext.java:4: package javax.comm does not exist
import javax.comm.*; // for SUN's serial/parallel port libraries
^
nulltext.java:7: cannot find symbol
symbol: class SerialPortEventListener
public class nulltest implements Runnable, SerialPortEventListener {
                                           ^
nulltext.java:8: cannot find symbol
symbol  : class CommPortIdentifier
location: class nulltest
   static CommPortIdentifier portId;
          ^
nulltext.java:9: cannot find symbol
symbol  : class CommPortIdentifier
location: class nulltest
   static CommPortIdentifier saveportId;
          ^
nulltext.java:12: cannot find symbol
symbol  : class SerialPort
location: class nulltest
   SerialPort           serialPort;
   ^
nulltext.java:135: cannot find symbol
symbol  : class SerialPortEvent
location: class nulltest
   public void serialEvent(SerialPortEvent event) {
                           ^
nulltext.java:46: cannot find symbol
symbol  : variable CommPortIdentifier
location: class nulltest
      portList = CommPortIdentifier.getPortIdentifiers();
                 ^
nulltext.java:48: cannot find symbol
symbol  : class CommPortIdentifier
location: class nulltest
         portId = (CommPortIdentifier) portList.nextElement();
                   ^
nulltext.java:49: cannot find symbol
symbol  : variable CommPortIdentifier
location: class nulltest
         if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                                     ^
nulltext.java:96: cannot find symbol
symbol  : class SerialPort
location: class nulltest
         serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
                       ^
nulltext.java:97: cannot find symbol
symbol  : class PortInUseException
location: class nulltest
      } catch (PortInUseException e) {}
               ^
nulltext.java:112: cannot find symbol
symbol  : variable SerialPort
location: class nulltest
         serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                                              ^
nulltext.java:113: cannot find symbol
symbol  : variable SerialPort
location: class nulltest
                     SerialPort.STOPBITS_1,
                     ^
nulltext.java:114: cannot find symbol
symbol  : variable SerialPort
location: class nulltest
                     SerialPort.PARITY_NONE);
                     ^
nulltext.java:115: cannot find symbol
symbol  : class UnsupportedCommOperationException
location: class nulltest
      } catch (UnsupportedCommOperationException e) {}
               ^
nulltext.java:137: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.BI:
           ^
nulltext.java:138: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.OE:
           ^
nulltext.java:139: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.FE:
           ^
nulltext.java:140: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.PE:
           ^
nulltext.java:141: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.CD:
           ^
nulltext.java:142: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.CTS:
           ^
nulltext.java:143: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.DSR:
           ^
nulltext.java:144: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.RI:
           ^
nulltext.java:145: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
           ^
nulltext.java:147: cannot find symbol
symbol  : variable SerialPortEvent
location: class nulltest
      case SerialPortEvent.DATA_AVAILABLE:
           ^
26 errors

C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\com.java>javac -extdirs li
b SerialTest.java
SerialTest.java:3: cannot find symbol
symbol  : class CommPortIdentifier
location: package gnu.io
import gnu.io.CommPortIdentifier;
             ^
SerialTest.java:4: cannot find symbol
symbol  : class SerialPort
location: package gnu.io
import gnu.io.SerialPort;
             ^
SerialTest.java:5: cannot find symbol
symbol  : class SerialPortEvent
location: package gnu.io
import gnu.io.SerialPortEvent;
             ^
SerialTest.java:6: cannot find symbol
symbol  : class SerialPortEventListener
location: package gnu.io
import gnu.io.SerialPortEventListener;
             ^
SerialTest.java:9: cannot find symbol
symbol: class SerialPortEventListener
public class SerialTest implements SerialPortEventListener {
                                   ^
SerialTest.java:10: cannot find symbol
symbol  : class SerialPort
location: class SerialTest
        SerialPort serialPort;
        ^
SerialTest.java:83: cannot find symbol
symbol  : class SerialPortEvent
location: class SerialTest
        public synchronized void serialEvent(SerialPortEvent oEvent) {
                                             ^
SerialTest.java:27: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                CommPortIdentifier portId = null;
                ^
SerialTest.java:28: cannot find symbol
symbol  : variable CommPortIdentifier
location: class SerialTest
                Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
                                       ^
SerialTest.java:32: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                        CommPortIdentifier currPortId = (CommPortIdentifier) por
tEnum.nextElement();
                        ^
SerialTest.java:32: cannot find symbol
symbol  : class CommPortIdentifier
location: class SerialTest
                        CommPortIdentifier currPortId = (CommPortIdentifier) por
tEnum.nextElement();
                                                         ^
SerialTest.java:48: cannot find symbol
symbol  : class SerialPort
location: class SerialTest
                        serialPort = (SerialPort) portId.open(this.getClass().ge
tName(),
                                      ^
SerialTest.java:53: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.DATABITS_8,
                                        ^
SerialTest.java:54: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.STOPBITS_1,
                                        ^
SerialTest.java:55: cannot find symbol
symbol  : variable SerialPort
location: class SerialTest
                                        SerialPort.PARITY_NONE);
                                        ^
SerialTest.java:84: cannot find symbol
symbol  : variable SerialPortEvent
location: class SerialTest
                if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
                                             ^
16 errors

C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\com.java>

isto é o que a pasta contem:

 O volume na unidade C nÆo tem nome.
O n£mero de s‚rie do volume ‚ 64DB-CBC0

Direct¢rio de C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\com.java

08-11-2010  20:59    <DIR>          .
08-11-2010  20:59    <DIR>          ..
08-11-2010  20:59    <DIR>          lib
08-11-2010  15:48             5.319 nulltext.java
08-11-2010  21:00                 0 out.txt
04-11-2010  17:40             3.058 SerialTest.java
               3 ficheiro(s)            8.377 bytes

Direct¢rio de C:\Users\Oxigen_cult\Desktop\arduino-0021\~~programas\com.java\lib

08-11-2010  20:59    <DIR>          .
08-11-2010  20:59    <DIR>          ..
08-03-2004  07:44            26.285 RXTXcomm.jar
08-03-2004  07:44            48.258 rxtxParallel.dll
08-03-2004  07:44            75.340 rxtxSerial.dll
               3 ficheiro(s)          149.883 bytes

     Total de ficheiros listados:
               6 ficheiro(s)          158.260 bytes
               5 dir(s)        26.559.721.472 bytes livres

agradeço a ajuda,

cumprimentos!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.