cancel
Showing results for 
Search instead for 
Did you mean: 

Code generation fails on ArchLinux with OpenJDK 18.0.1.1

JPOID.1
Associate

My code generation fails with the following exception :

Exception in thread "Thread-4645" java.lang.IllegalAccessError: class parsers.FromScratchParser (in unnamed module @0x6a84a97d) cannot access class com.sun.org.apache.xerces.internal.parsers.DOMParser (in module java.xml) because module java.xml does not export com.sun.org.apache.xerces.internal.parsers to unnamed module @0x6a84a97d
 
    at parsers.FromScratchParser.getDestinations(FromScratchParser.java:257)
 
    at convertor.Convertor.generate(Convertor.java:354)
 
    at com.st.microxplorer.plugins.projectmanager.model.ToolchainGenerator.generate(ToolchainGenerator.java:370)
 
    at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createToolChainFolders(ProjectBuilder.java:4150)
 
    at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createProject(ProjectBuilder.java:916)
 
    at com.st.microxplorer.plugins.projectmanager.engine.GenerateProjectThread.run(GenerateProjectThread.java:54)

Here's my java version

�?� java --version
openjdk 18.0.1.1 2022-04-22
OpenJDK Runtime Environment (build 18.0.1.1+2)
OpenJDK 64-Bit Server VM (build 18.0.1.1+2, mixed mode)

Full log is attached.

1 ACCEPTED SOLUTION

Accepted Solutions
FPlow.1
Associate II

I had the exact same issue. The issue is that STM32CubeMX does not support java 18, only java 11.

On Arch, STM32CubeMX can be configured to use java 11 on a per-application basis by editing /usr/bin/stm32cubemx (or creating in a location in $PATH with precedence) to use an explicit runtime, for example:

#!/bin/sh
exec /usr/lib/jvm/java-11-openjdk/bin/java -jar /opt/stm32cubemx/STM32CubeMX "$@"

or on a system-wide basis by running `archlinux-java set java-11-openjdk`

View solution in original post

2 REPLIES 2
FPlow.1
Associate II

I had the exact same issue. The issue is that STM32CubeMX does not support java 18, only java 11.

On Arch, STM32CubeMX can be configured to use java 11 on a per-application basis by editing /usr/bin/stm32cubemx (or creating in a location in $PATH with precedence) to use an explicit runtime, for example:

#!/bin/sh
exec /usr/lib/jvm/java-11-openjdk/bin/java -jar /opt/stm32cubemx/STM32CubeMX "$@"

or on a system-wide basis by running `archlinux-java set java-11-openjdk`

JPOID.1
Associate

Amazing, thanks for the explantation !