View previous topic :: View next topic |
Author |
Message |
Erdie Advocate
Joined: 20 May 2004 Posts: 2625 Location: Heidelberg - Germany
|
Posted: Sun Feb 26, 2023 5:11 pm Post subject: FIXED: Arduino serial monitor failed |
|
|
Dear all,
when I triy to open the serial monitor within the Arduino IDE, the ardunio is reset and the console does not work. The log output shows the following:
Code: |
Exception in thread "EventThread /dev/ttyUSB0" java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
at processing.app.Serial.processSerialEvent(Serial.java:210)
at processing.app.Serial.serialEvent(Serial.java:183)
at jssc.SerialPort$LinuxEventThread.run(SerialPort.java:1299)
|
I am working with arduino nano and I even made a lot of projects with esp8266. In the past the serial monitor worked definatly. For testing I switched back to an old project with esp8266 and I get the same error when starting the monitor.
I guess this is a java vm issue, trying "eselect java-vm list" gives me:
Code: |
eselect java-vm list
Available Java Virtual Machines:
[1] openjdk-bin-8 system-vm
[2] openjdk-bin-17 user-vm
|
In my opinion the baud rate cannot be the reason since my unchanged old project do not work either.
I tried both vms and get the error with both of them. Are there any ideas how to fix this? _________________ Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W
Last edited by Erdie on Mon Feb 27, 2023 3:21 pm; edited 2 times in total |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1136 Location: Richmond Hill, Canada
|
Posted: Sun Feb 26, 2023 6:02 pm Post subject: |
|
|
Erdie,
I found a github issue seems to match your error message. The explanation is that Java 9 change the API for the flip() method from returning Buffer to ByteBuffer.
So my guess is that if you can use java8 it will probably work. |
|
Back to top |
|
|
Erdie Advocate
Joined: 20 May 2004 Posts: 2625 Location: Heidelberg - Germany
|
Posted: Sun Feb 26, 2023 7:03 pm Post subject: |
|
|
pingtoo wrote: |
So my guess is that if you can use java8 it will probably work. |
Unfortunately the error persits if I switch the java-vm like this:
Code: |
eselect java-vm list
Available Java Virtual Machines:
[1] openjdk-bin-8 system-vm user-vm
[2] openjdk-bin-17
|
Or isn´t that option really "java8" ? _________________ Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1136 Location: Richmond Hill, Canada
|
Posted: Sun Feb 26, 2023 8:13 pm Post subject: |
|
|
Erdie,
Assume your "Arduino IDE" is based on dev-embedded/arduino.
I found additional two online articles that match the error message "java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer". [1], [2]
They all basically explain the same in the link I previously posted. It is caused by newer version of java compiler build for older 1.8 java target usage will have incompatibility issue.
[1] is from arduino forum which lead to a old arduino github issue suggest for Arch using a older version of arduino package will solve this problem. But in Gentoo I guess you don't have this option because it is a very old arduino version.
[2] is a detail explain of why newer version java compiler by default will create incompatible code for java 1.8 and offered a suggestion on how to using newer version java compiler to produce java 1.8 compatible code. However when I review Gentoo dev-embeded/arduino ebuild file, I found it is just taking githib anduino/Anduino project release and repackage to fit into Gentoo portage. In the ebuild I did not see there is compile stage. so It will not be easy to modify with [2] suggestion.
As suggestion in [1] it is recommend that use official Arduino IDE bundle to development your project. Otherwise you can try to rebuild dev-embedded/arduino after you switch to java 1.8 to see if the result build will work for you.
- Minimum java version
- ByteBuffer and the Dreaded NoSuchMethodError
|
|
Back to top |
|
|
Erdie Advocate
Joined: 20 May 2004 Posts: 2625 Location: Heidelberg - Germany
|
Posted: Mon Feb 27, 2023 9:48 am Post subject: |
|
|
Thanks, I will try the last option (rebuild IDE after switching java version). BTW I also found multiple sources about java version issues and therefore my guess was exactly like that. Let me try to rebuild the IDE fist. _________________ Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W |
|
Back to top |
|
|
Erdie Advocate
Joined: 20 May 2004 Posts: 2625 Location: Heidelberg - Germany
|
Posted: Mon Feb 27, 2023 3:20 pm Post subject: |
|
|
Setting system & user vm to openjdk-bin-17 and rebuilding dev-embedded/arduino did the job!
Thanks! _________________ Desktop AMD Ryzen 9 5900X 32GB RAM, Asus GF GTX 1060.
Notebook Tuxedo Pulse 15 Gen1 AMD Ryzen 7 4800H mit Radeon Vega 7
Raspberry Pi 1 + 2 + 3B+ + Zero W |
|
Back to top |
|
|
|