cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX crashes on launch with OpenJDK16

FUhl.2
Associate

I recently upgraded from OpenJDK15 to 16 on my machine and noticed that STM32CubeMX now crashes at launch. The splashscreen shows up, but the main window never appears.

Here's a slightly abbreviated output:

$ java -jar STM32CubeMX
log4j user configuration file not found: /home/[...]/.stm32cubemx/log4j.properties
Configure log4j with default settings from jar:file:/opt/STM32CubeMX/STM32CubeMX.exe!/log4j/log4j.stm32cubemx.properties
2021-04-25 22:46:19,141 [INFO] MicroXplorer:76 - [MX] MX Start
2021-04-25 22:46:19,143 [INFO] MicroXplorer:564 - Detected Java Version = 16
[...]
2021-04-25 22:46:20,022 [INFO] PluginManage:178 - Search for loadable plugins [exclusion list=, ]
2021-04-25 22:46:20,024 [INFO] PluginManage:292 - Check plugin analytics
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
        at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:990)
        at com.thoughtworks.xstream.XStream.<init>(XStream.java:593)
        at com.thoughtworks.xstream.XStream.<init>(XStream.java:515)
        at com.thoughtworks.xstream.XStream.<init>(XStream.java:484)
        at com.thoughtworks.xstream.XStream.<init>(XStream.java:430)
        at com.thoughtworks.xstream.XStream.<init>(XStream.java:397)
        at com.st.library.rawvaluescontainer.FilesUtils.<clinit>(FilesUtils.java:41)
        at com.st.library.analyticscore.AnalyticsContext.<init>(AnalyticsContext.java:167)
        at com.st.library.dynamicproxy.AnalyticsInvocationHandler.<init>(AnalyticsInvocationHandler.java:36)
        at com.st.library.builder.AnalyticsBuilder.getAnalytics(AnalyticsBuilder.java:33)
        at com.st.library.analyticscore.AnalyticsAPI.initialize(AnalyticsAPI.java:132)
        at com.st.microxplorer.plugins.analytics.AnalyticsPlugin.<init>(AnalyticsPlugin.java:165)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
        at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
        at java.base/java.lang.Class.newInstance(Class.java:642)
        at com.st.microxplorer.plugin.PluginManage.loadPluginJar(PluginManage.java:335)
        at com.st.microxplorer.plugin.PluginManage.PluginSearch(PluginManage.java:206)
        at com.st.microxplorer.plugin.PluginManage.PluginDiscovery(PluginManage.java:49)
        at com.st.microxplorer.maingui.MainPanel.initialization(MainPanel.java:236)
        at com.st.microxplorer.maingui.MainFrame.initialization(MainFrame.java:149)
        at com.st.microxplorer.maingui.MicroXplorer.run(MicroXplorer.java:226)
        at com.st.microxplorer.maingui.STM32CubeMX.run(STM32CubeMX.java:25)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @227132a6
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
        at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
        at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
        ... 39 more

This seems to be an issue with an outdated version of XStream, see https://github.com/x-stream/xstream/issues/101#issuecomment-722701986

3 REPLIES 3
Khouloud ZEMMELI
ST Employee

Hello @FUhl.2​ ,

Thanks for your question,

Could you please give me more details about the CubeMX version used?

Khouloud

FUhl.2
Associate

Hi Khouloud, the version I'm using is 6.2.1

Hi again @FUhl.2​ 

Thanks for your reply,

In fact, previously CubeMX used the default JRE installed on the system, which may not conform to the one we recommend, for that, and since the 6.2.0 version, the JRE has become integrated in CubeMX, therefore, this command has become obsolete : "java -jar STM32CubeMX".

To run CubeMX from Command line, this command must be used instead : "cd <STM32CubeMX installation path> jre\bin\java -jar STM32CubeMX.exe ".

Hope my answer helped you :) When your question is answered and your problem is resolved, please close the topic by choosing Select as best, this will help other users find that answer faster.

Thanks for your contribution, Khouloud