cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer execute fail with Could not find or load main class com.st.app.Main

Acui.1
Associate

Hi all, I'm new to STM32 and I encountered with an error when I run STM32CubeProgrammer after installing the tool on Ubuntu 18.04 according to STM UM2237 user manual

the error is : Could not find or load main class com.st.app.Main.

I googled and it was said that it might be the CLASSPATH config problem which leads to the class cannot be found. But I searched the install path which is /home/mypath/STMicroelectronics/STM32Cube/ and cannot find any JAVA class looks like this main class(only 3 JAR file found: uninstaller.jar, OpenJFXWarning.jar and STLinkUpgrade.jar), and I even don't know which path to add to CLASSPATH.

Does anyone have ideas about why this happened and how to fix it, thanks in advance.

18 REPLIES 18
MTorr.3
Associate II

They could always do like they did with STM32CubeMonitor-RF and provide a bundled jre8 with all of their dependencies. That would be nice...

https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html

MTorr.3
Associate II

Curiously enough, after installing the Oracle JRE8 I get a popup message with:

```

CubeProgrammer_API or one of its dependencies is missing. Please try

reinstalling the program or check your java architecture.

​```

However, if I try to reinstall using the Oracle JRE8 it fails, complaining of a non existing file (it looks like the installer is trying to`chmod` a file before copying it).

So there's that, can't upgrade the stm32wb55 with the provided software.

Here's an alternative:

https://github.com/stlink-org/stlink

Most Linux distributions with a package manager should have that with the names:

  • libstlink1
  • stlink-gui
  • stlink-tools

if not you can build it from source.

Cheers!

I found a solution for Ubuntu 20.04 here:

https://stackoverflow.com/a/62198111

Installing deb package "Liberica Full JRE 8u252+9 x86 64 bit for Linux" worked for me getting CuboProgrammer starting on Ubuntu 20.04.

I can confirm this also works with Debian Buster and Bullseye. Although I also see some exceptions while running the app, it still runs.

Thanks! =)

Works voor lubuntu 18.04

Thank you FOtn.1 !!!

Thanks for FOtn.1 !!

Works with bellsoft-jdk8u265+1-linux-amd64-full.deb on Linux Mint 20 Cinnamon .

FLACO.1
Associate II

Hi,

To make it work with the bundled openjfx package, you may edit the bin/STM32CubeProgrammer and add your openjfx path and modules :

java --module-path /usr/share/openjfx/lib --add-modules javafx.controls,javafx.fxml,javafx.web -jar $DIR/STM32CubeProgrammerLauncher

FBusy.1
Associate

I used openjfx-15 solved this problem,download openjfx-15_linux-x64_bin-sdk.zip from https://openjfx.io/​, unzip to somewhere(such as :/usr/opt/),then modify the program startup file(${Program installation directory}/bin/STM32CubeProgrammer),may need sudo ,replace the last line "java -jar $DIR/STM32CubeProgrammerLauncher" with "java --module-path /usr/opt/javafx-sdk-15/lib --add-modules=javafx.base --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-modules=javafx.controls -jar $DIR/STM32CubeProgrammerLauncher", "/usr/opt/javafx-sdk-15/lib" is your openjfx's path, and my javasdk is jdk11, I also tried jdk12, also worked well.

FM.1
Associate III

On Ubuntu 22.04, installed using default paths (version 1.1.1). Then define this in ~/.bashrc

alias stm32-monitor-power='$HOME/STMicroelectronics/STM32CubeMonitor-Power/jre/bin/java -jar $HOME/STMicroelectronics/STM32CubeMonitor-Power/STM32CubeMonitor-Power.jar'

To start use:

stm32-monitor-power