Error with Java reading the incoming bytes from the arduino

I have absolutely no clue what any this stuff means other than my program keeps crashing. I will upload the full error file if someone is willing to help me out. Sorry if this is super vague, if you ask questions I’ll be happy to answer

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f7b40164462, pid=16431, tid=140167332878080
#
# JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.5-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [librxtxSerial.so+0x6462]  read_byte_array+0x52
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

my program keeps crashing

Do you mean the Arduino IDE is crashing?

Or is it your own Java program to read the Serial (or some other form of data) ????????

No no. The Arduino IDE works flawlessly for me. I am using the java source code from the "Interfacing Java" page under playground. When I have the Arduino print something using the Serial, the actual Java program crashes and spits out this NASTY error.

Most of the people here write C/C++ to run on the Arduino. So this is not the right place to ask for help with another language running on another platform.

Mark

Most of the people here write C/C++ to run on the Arduino. So this is not the right place to ask for help with another language running on another platform.

The Arduino IDE uses java. The errors are java.

Can you post a link to the Java code you are using?

Or, if you have modified the code in ANY way, post a copy of your code.

Describe what you are doing up to the point of the crash is as much detail as possible.

I note you are using Java8. have you tried it with Java7?

...R

steinie44:

Most of the people here write C/C++ to run on the Arduino. So this is not the right place to ask for help with another language running on another platform.

The Arduino IDE uses java. The errors are java.

But they are not coming from the IDE, they are coming from a Java program running on the PC.

The OP says

The Arduino IDE works flawlessly for me.

so it is irrelevant that the IDE is written in Java.

austinkregel: I have absolutely no clue what any this stuff means

Your Java application is using some native (non-Java) code to do the serial I/O. That external code is causing a segmentation violation. That usually indicates that memory has become corrupted. I'd look for possible operational reasons that might provoke an error inside the serial port I/O - such as failing to read data as fast as it is arriving, trying to write data faster than it can be sent, or failing to configure the serial port correctly, or the serial port itself failing.

I litterally cut and pasted the code from the http://playground.arduino.cc/Interfacing/Java page underneith “Sample Java Code”
I threw that into the Eclipse IDE along with a copy of the RXTX Library (Jar) 2.1.7 (R2). Then I clicked Run. It started nicely then I had the attached crash report from the program.

For the arduino printing out on the Serial, I have it doing the “AnalogReadSerial” example.

I have not modified any of the code mentioned above. I literally just copied and pasted.

hs_err_pid23787.log (32.4 KB)

I fixed the problem myself. I figured I didn't have the correct ".so" file attached to the native libraries for the RXTX file so I first went to reinstall the RXTX library on my Ubuntu computer. I re-installed the RXTX library using the debian/ubuntu command " sudo apt-get install librxtx-java ". I found the resulting folder at "/usr/lib/jni". I then went to the build path for the project in Eclipse, I clicked on the arrow the the left of the RXTX jar. I then clicked on "Native Library Location" and clicked "Edit". Once the library was re-installed I went back to Eclipse and clicked external folder, I located the "/usr/lib/jni" folder in the browser that opened up and clicked "Okay". I ran my program and it didn't crash.

This is a Java error - you need to look for(*) bug reports in your version of java to see if there's a workaround. You may be using a different version of java if running standalone from the Arduino IDE, and it may be buggy.

(*) google "java bug librxtxSerial.so readByteArray" or something likely to throw up bug report pages.

austinkregel:
I fixed the problem myself.

Good news.

I have started using JSSC instead of RXTX as support for RXTX seems to have withered. JSSC seems to be easier to use and it comes with its own documentation which is very nice.

This sort of question is usually posted in the Interfacing w/ Software on the Computer section of the Forum. Someone there had a problem with the same Playground example in the last few weeks. I think they switched it to use JSSC.

…R

That playground article seems to be saying that the IDE includes a copy of the RXTX library and implies that you only need to obtain your own copy if you haven't installed the IDE.

PeterH: That playground article seems to be saying that the IDE includes a copy of the RXTX library and implies that you only need to obtain your own copy if you haven't installed the IDE.

Depending on how you install the IDE it might not be generally accessible.

For example on this Linux PC I just extracted the IDE and saved it all in a directory - I didn't go through any installation process. Not having to do that is one of the joys of the JVM.

...R

Robin2: Depending on how you install the IDE it might not be generally accessible.

Is there any installation mode that doesn't put the implementation in JAR files? In my 1.5.5 installation in Windows the IDE installation directory contains RXTXcomm.jar. I would be surprised to find that it was packaged substantially differently on other platforms.

Where does the Windows installation put the Arduino IDE files? Perhaps it creates a path reference to the location of the JAR file?

Interestingly I downloaded 1.5.6-r2 earlier today and just looking into it a few minutes ago I see that the /lib directory contains JSSC rather than RXTX. I haven't tried to use 1.5.6 yet.

...R