Go Down

Topic: Serial Communication with Netbeans and Arduino. (Read 1 time) previous topic - next topic

lewisjoyce

Hi Everyone.

i am trying to get my arduino to communicate to netbeans and im having trouble with getting it to work.
my code is
"package serialtalk;

import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.io.InputStream;
import java.io.OutputStream;
import processing.app.Preferences;

public class Main {
    static InputStream input;
    static OutputStream output;

    public static void main(String[] args) throws Exception{
       
        System.out.println("Using port: " + Preferences.get("serial.port"));
        CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(
                Preferences.get("serial.port"));

        SerialPort port = (SerialPort)portId.open("serial talk", 4000);
        input = port.getInputStream();
        output = port.getOutputStream();
        port.setSerialPortParams(Preferences.getInteger("serial.debug_rate"),
                SerialPort.DATABITS_8,
                SerialPort.STOPBITS_1,
                SerialPort.PARITY_NONE);
        while(true){
            while(input.available()>0) {
                System.out.print((char)(input.read()));
            }
        }
    }
}
"

and the error i get is

java.lang.UnsatisfiedLinkError: C:\Users\mhsec\Desktop\arduino-1.0.4\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\mhsec\Desktop\arduino-1.0.4\rxtxSerial.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
   at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
   at java.lang.Runtime.loadLibrary0(Runtime.java:823)
   at java.lang.System.loadLibrary(System.java:1028)
   at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
   at serialtalk.Main.main(Main.java:16)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

I'm extremely lost and i'm not sure what to do.

Regards
Lewis Joyce
Lewis Joyce

Hi Lewis

i think the error message is quite obvious:
rxtxSerial.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

Do you have a 64bit version of rxtxSerial.dll that you can use? Because it looks like you are trying to use a 32bit dll in a 64bit project.
Or is there a setting in Netbeans where you can define your project as a 32bit application. (Rather than 64bit...)

lewisjoyce

Yeah i saw this message, but i downloaded the RXTX comm and serial in 64bit. And put it in the arduino files and then my arduino program wont load up and i get a launch4j error message.
So im a bit lost in what i can do

Regards

Lewis Joyce
Lewis Joyce

laadams85

I'm not sure why you want to used those libraries anyways.  Getting java to work with serial ports is really easy without it.

lewisjoyce

ah, im new to all this, so ive been following a tutorial and i dont know how to do it any other way.

regards
Lewis
Lewis Joyce

Go Up