kurbatov / firmata4j

Firmata client written in Java.
MIT License
87 stars 45 forks source link

A fatal error has been detected by the Java Runtime Environment #45

Closed ghost closed 3 years ago

ghost commented 3 years ago

StandardFirmata is uploaded on my arduino every thing is fine. but when i run the code eclipse shows image and the creates this .log file hs_err_pid7000.log

kurbatov commented 3 years ago

Please, add the following line after device.start() and see what happens:

device.ensureInitializationIsDone();
ghost commented 3 years ago

Still same :( image

kurbatov commented 3 years ago

It looks like a problem with a native part of jssc library.

There is one thing you can try with unreleased version of firmata4j.

The first step would be cloning this repository and building it locally:

$ git clone ggit@github.com:kurbatov/firmata4j.git
$ cd firmata4j
$ mvn install

After that you want to modify the pom.xml of your project with regard to dependencies to firmata4j:

<dependency>
    <groupId>com.github.kurbatov</groupId>
    <artifactId>firmata4j</artifactId>
    <version>2.3.9-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.scream3r</groupId>
            <artifactId>jssc</artifactId>
        </exclusion>
     </exclusions>
</dependency>
<dependency>
    <groupId>com.fazecast</groupId>
    <artifactId>jSerialComm</artifactId>
    <version>2.6.2</version>
</dependency>

Note that the version of firmata4j changes, jssc is excluded and a newer jSerialComm library is added to the dependencies.

Now, in order to use jSerialComm library, modify your code along the following lines:

IODevice device = new FirmataDevice(new JSerialCommTransport("/dev/ttyUSB0"));
device.start();
device.ensureInitializationIsDone();

Note that the constructor of FirmataDevice should get an instance of JSerialCommTransport to use jSerialComm library as a transport to the device.

ghost commented 3 years ago

thanks. it worked :) <3