Ahmad Akanci Ahmad Akanci - 22 days ago 7
Java Question

Arduino Serial Communication from Java

I can't serial the port JAVA to Arduino ..
I Get this error

Load RxTx
Windows 10


java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while

loading gnu.io.RXTXCommDriver

Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in

java.library.path

at java.lang.ClassLoader.loadLibrary(Unknown Source)

at java.lang.Runtime.loadLibrary0(Unknown Source)

at java.lang.System.loadLibrary(Unknown Source)

at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:123)

at org.sintef.jarduino.comm.Serial4JArduino.connect(Serial4JArduino.java:88)

at org.sintef.jarduino.comm.Serial4JArduino.(Serial4JArduino.java:82)

at org.sintef.jarduino.AbstractJArduino.(AbstractJArduino.java:30)

at org.sintef.jarduino.JArduino.(JArduino.java:45)

at Arduino.ArduinoServer.(ArduinoServer.java:25)

at Arduino.ArduinoServer.main(ArduinoServer.java:37)


JAVA CODE

package Arduino;

import java.net.URISyntaxException;
import java.util.Scanner;

import org.sintef.jarduino.DigitalPin;
import org.sintef.jarduino.DigitalState;
import org.sintef.jarduino.JArduino;
import org.sintef.jarduino.PinMode;

public class ArduinoServer extends JArduino{

public ArduinoServer(String port) {
super(port);
// TODO Auto-generated constructor stub
}

static int LedParlakligi=0;
public static void main(String[] Args)
{

String serialPort;

serialPort = "1";

JArduino arduino = new ArduinoServer(serialPort);
arduino.runArduinoProcess();


}
@Override
protected void loop() {

digitalWrite(DigitalPin.PIN_9, DigitalState.fromValue((byte)10));
delay(50); // wait for a second

}
@Override
protected void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(DigitalPin.PIN_9, PinMode.OUTPUT);

}


}


MY Libraries all
Libraires

Answer

You need to have have the native library installed on your machine: http://rxtx.qbang.org/wiki/index.php/Download

Link to it in Eclipse: Project -> Properties -> Java Build Path -> Libraries -> RXTXcomm -> Native library location