package NClang.tinycompile;
import org.sintef.jarduino.DigitalPin;
import org.sintef.jarduino.DigitalState;
import org.sintef.jarduino.JArduino;
import org.sintef.jarduino.PinMode;
import org.sintef.jarduino.comm.Serial4JArduino;
public class Blink extends JArduino {
public Blink(String port) {
super(port);
}
protected void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(DigitalPin.PIN_12, PinMode.OUTPUT);
}
@Override
protected void loop() {
// set the LED on
digitalWrite(DigitalPin.PIN_12, DigitalState.HIGH);
delay(1000); // wait for a second
// set the LED off
digitalWrite(DigitalPin.PIN_12, DigitalState.LOW);
delay(1000); // wait for a second
}
public static void main(String[] args) {
String serialPort;
if (args.length == 1) {
serialPort = args[0];
} else {
serialPort = Serial4JArduino.selectSerialPort();
}
JArduino arduino = new Blink(serialPort);
arduino.runArduinoProcess();
}
}这是我在Arduino Uno板上闪烁LED的代码,但它抛出
Load RxTx
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.<clinit>(CommPortIdentifier.java:123)
at org.sintef.jarduino.comm.Serial4JArduino.getAvailableSerialPorts(Serial4JArduino.java:244)
at org.sintef.jarduino.comm.Serial4JArduino.selectSerialPort(Serial4JArduino.java:289)
at NClang.tinycompile.Blink.main(Blink.java:36)我已经将rxtxSerial库导入到我的路径中,当我再次尝试导入它时,它会说:
rxtxSerial already in path, no changes have been made我已经看过这个网站上关于这个问题的一些帖子,但是他们都说类似于“将rxtxSerailcomm.jar和.dll导入到正确的目录中。
发布于 2018-01-23 04:03:57
您必须确保库(dll/so文件)已添加到您的项目中。您必须在您的设置中查找Native library location。看看下面的内容。

您想要在那里添加dll/so文件。
发布于 2018-01-20 18:05:52
您需要将org.sintef.jarduino.core-0.1.7-SNAPSHOT.jar添加到您的构建路径中(右键单击您的项目-> Build Path -> Configure Build Path -> Libraries选项卡)
https://stackoverflow.com/questions/48354252
复制相似问题