Skip to content

Arduino 1:1.8.9-3(compiled with jdk9?) ByteBuffer breaks libraries #8903

Open
@DWShuo

Description

@DWShuo

Using RF24 library for nRF24L01
upgraded arduino (1:1.8.9-1 -> 1:1.8.9-3)
OS: arch linux

Following error is thrown after upgrade
Exception in thread "EventThread /dev/ttyUSB1" java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
at processing.app.Serial.serialEvent(Serial.java:185)
at jssc.SerialPort$LinuxEventThread.run(SerialPort.java:1299)

Relevant github issue?
apache/felix#114

Activity

DWShuo

DWShuo commented on May 21, 2019

@DWShuo
Author

Just rolled back to package version 1:1.8.9-1, and everything works fine.
Seems like 1:1.8.9-3 is indeed the issue

facchinm

facchinm commented on May 21, 2019

@facchinm
Member

@NicoHood maybe you lost this 😉

harkor

harkor commented on May 29, 2019

@harkor

Same issue here.

Rolling back to 1:1.8.9-1 working :)

added
Upstream notifiedRelated to a software component maintained by someone else. They have been notified of it
on May 29, 2019
NicoHood

NicoHood commented on May 29, 2019

@NicoHood
Contributor

What should I do to fix this??

facchinm

facchinm commented on May 29, 2019

@facchinm
Member

I think compiling with java8 should fix it

NicoHood

NicoHood commented on May 30, 2019

@NicoHood
Contributor

But shouldn't Arduino support java 8 and all higher versions?

facchinm

facchinm commented on May 30, 2019

@facchinm
Member

I think you need to compile the jars with java 8 exactly, so the dependency here should be java-runtime=8 (I think)

DWShuo

DWShuo commented on May 30, 2019

@DWShuo
Author

Ok figure it out, for some reason arch defaults to jdk8, you have to manually set java to a higher version.
Do this to check which versions of java you have installed
archlinux-java status
if java-8-openjdk/jre is your only option then run this
pacman -Syu jdk-openjdk
run archlinux-java status again should have java11 now as an option
switch to java11
sudo archlinux-java set java-11-openjdk

NicoHood

NicoHood commented on May 31, 2019

@NicoHood
Contributor

I am not very familiar with java programming. Code compiled with java will only run with java8 interpreter? Or will it run with 8 and every version above? Is the problem that I've compiled the code with java 11, but with an old java8 interpreter it crashes? Changing the OS java version does not sound like a solution, more a workaround. Can somebody please explain me better how this works?

PaulStoffregen

PaulStoffregen commented on May 31, 2019

@PaulStoffregen
SponsorContributor

Kind of a moot point, since the Arduino IDE bundles the correct Java JRE which precisely matches the version of the Java SDK they used to build the code.

winksaville

winksaville commented on Jun 13, 2019

@winksaville

@NicoHood as @PaulStoffregen says, the Java SDK should probably be used. The reason is not all Java 8's are the same.

On my arch linux system, just updated:

$ uname -a
Linux wink-desktop 5.1.9-arch1-1-ARCH #1 SMP PREEMPT Tue Jun 11 16:18:09 UTC 2019 x86_64 GNU/Linux

I have java 8 installed as my default:

$ archlinux-java status
Available Java environments:
  java-10-openjdk
  java-11-openjdk
  java-8-openjdk (default)

And the version reported by java is 1.8.0_212:

$ /usr/bin/java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b01)
OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)

Which is slightly different from the version provided by arduino-1.8.9, 1.8.0_191:

$ ./bin/arduino-1.8.9/java/bin/java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

And I don't get the "NoSuchMethodError" when I'm using arduino-1.8.9 directly but I do get this error when I install the Arch Linux arduino package. A workaround that is suggested in the Arch Linux bug report 62704 of changing to java 10 or 11 does resolve this bug but then I get some warnings:

$ /usr/share/arduino/arduino
Picked up JAVA_TOOL_OPTIONS: 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by processing.app.linux.GTKLookAndFeelFixer (file:/usr/share/arduino/lib/arduino-core.jar) to field com.sun.java.swing.plaf.gtk.GTKLookAndFeel.styleFactory
WARNING: Please consider reporting this to the maintainers of processing.app.linux.GTKLookAndFeelFixer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

So it seems it would be best to change Arch Linux arduino PKGBUILD to use the java provided by arduino and not the system installed version.

PaulStoffregen

PaulStoffregen commented on Jun 13, 2019

@PaulStoffregen
SponsorContributor

Seems to me this is a problem with Arch Linux. The software Arduino.cc distributes always has the correct JRE bundled, so I do not believe reporting the problem here is correct.

toketin

toketin commented on Jul 11, 2019

@toketin

Hi, i confirm with Java 12 i had issue with the menu theme of Arduino Ide. Reinstalling Java 8 and setting: archlinux-java set java-8-openjdk/jre i can get the correct theme again.

This was the output running arduino ide with Java 12 as default:

$ arduino                   
Picked up JAVA_TOOL_OPTIONS: 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by processing.app.linux.GTKLookAndFeelFixer (file:/usr/share/arduino/lib/arduino-core.jar) to field com.sun.java.swing.plaf.gtk.GTKLookAndFeel.styleFactory
WARNING: Please consider reporting this to the maintainers of processing.app.linux.GTKLookAndFeelFixer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
fam4r

fam4r commented on Oct 9, 2019

@fam4r

I can not access Serial using Java 8 and Arduino 1.8.9-3, but it works with Arduino 1.8.9-1.

Java 12 is not affected by that problem, but shows warnings as reported from some of you.

24 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: IDEThe Arduino IDEType: BugUpstream notifiedRelated to a software component maintained by someone else. They have been notified of it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @toketin@kolewu@molecular@StarsoftAnalysis@PaulStoffregen

      Issue actions

        Arduino 1:1.8.9-3(compiled with jdk9?) ByteBuffer breaks libraries · Issue #8903 · arduino/Arduino