collapse

* Posts Recentes

Amplificador - Rockboard HA 1 In-Ear por almamater
[Ontem às 19:13]


O que é isto ? por KammutierSpule
[26 de Março de 2024, 19:35]


Bateria - Portátil por almamater
[25 de Março de 2024, 22:14]


Emulador NES em ESP32 por dropes
[13 de Março de 2024, 21:19]


Escolher Osciloscópio por jm_araujo
[06 de Fevereiro de 2024, 23:07]


TP4056 - Dúvida por dropes
[31 de Janeiro de 2024, 14:13]


Leitura de dados por Porta Serie por jm_araujo
[22 de Janeiro de 2024, 14:00]


Distancia Cabo por jm_araujo
[08 de Janeiro de 2024, 16:30]


Meu novo robô por josecarlos
[06 de Janeiro de 2024, 16:46]


Laser Engraver - Alguém tem? por almamater
[16 de Dezembro de 2023, 14:23]

Autor Tópico: arduino+java  (Lida 4091 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
arduino+java
« em: 04 de Novembro de 2010, 18:04 »
boas!

estava a tentar seguir este tutorial ( http://www.arduino.cc/playground/Interfacing/Java ) para por o arduino a comunicar com java, mas não estou a conseguir compilar....


Código: [Seleccione]


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>

ao que parece faltam as bibliotecas não é? mas segundo o tutorial:
Citar
RXTX Library Set Up

If you installed the Arduino IDE, you already have the RXTX library installed for the next steps, and you may be able to skip this section and start with the sample Java code.


há aqui qualquer coisa que me esta a escapar  ::)

Offline CBX

  • Mini Robot
  • *
  • Mensagens: 1.315
Re: arduino+java
« Responder #1 em: 04 de Novembro de 2010, 18:19 »
tens a biblioteca na pasta do java?

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
Re: arduino+java
« Responder #2 em: 04 de Novembro de 2010, 18:30 »
nop, é esta a pasta?

Citar
C:\Program Files\Java\jdk1.6.0_21\lib

copio o rxtxSerial.dll que esta na pasta do arduino para essa pasta mas não compila a mesma...

Offline CBX

  • Mini Robot
  • *
  • Mensagens: 1.315
Re: arduino+java
« Responder #3 em: 04 de Novembro de 2010, 19:10 »
vai a rxtx.org e faz download da biblioteca mais recente.

dentro do zip encontras o ficheiro "RXTXcomm.jar" que vai para a pasta ...\Java\jre1.6.0_21\lib\ext\ e o ficheiro "rxtxSerial.dll" para a pasta ...\Java\jre1.6.0_21\bin\

assim já deve funcionar  ;)

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
Re: arduino+java
« Responder #4 em: 04 de Novembro de 2010, 19:33 »
vai a rxtx.org e faz download da biblioteca mais recente.

dentro do zip encontras o ficheiro "RXTXcomm.jar" que vai para a pasta ...\Java\jre1.6.0_21\lib\ext\ e o ficheiro "rxtxSerial.dll" para a pasta ...\Java\jre1.6.0_21\bin\

assim já deve funcionar  ;)

fiz isso (não tinha  a pasta ext, por isso criei uma, copiei o .jar para a a ext e mantive uma copia também na pasta lib) e continua na mesma :S


Offline CBX

  • Mini Robot
  • *
  • Mensagens: 1.315
Re: arduino+java
« Responder #5 em: 04 de Novembro de 2010, 19:48 »
experimenta a copiar também o "rxtxParallel.dll", mais não te posso ajudar, isto é o que eu faço para um programa que aqui tenho em java funcionar, de java não percebo nada...

Offline oxytech

  • Mini Robot
  • *
  • Mensagens: 75
Re: arduino+java
« Responder #6 em: 04 de Novembro de 2010, 20:02 »
experimenta a copiar também o "rxtxParallel.dll", mais não te posso ajudar, isto é o que eu faço para um programa que aqui tenho em java funcionar, de java não percebo nada...

sim pus também esse ficheiro.

ok, obrigado pela ajuda que já deste  :)