cancel
Showing results for 
Search instead for 
Did you mean: 

How to run CubeProgrammer on Windows 10 with AdoptOpenJDK

Pascal Rosin
Associate II

I am using AdoptOpenJDK 11. CubeMX is running with this after installing it from the commandline but CubeProgrammer is not starting (complainding "This application requires a Java Runtime Environment 1.8.0 - 10.99.99").

When trying to start it from the commandline with

STM32CubeProgrammer\bin> java -jar .\STM32CubeProgrammer.exe

it says "Main Class com.st.app.Main could not be found or loaded. Reason: java.lang.NoClassDefFoundError: javafx/application/Application"

Is there a way to run CubeProgrammer without Oracle's Java?

1 ACCEPTED SOLUTION

Accepted Solutions
Pascal Rosin
Associate II

There is a way to run the STM32CubeProgrammer with AdoptOpenJDK 11, but you will also need to install an OpenJFX SDK. I am using JavaFX 14 from here.

Installation of OpenJFX:

  • Unzip the downloaded SDK
  • Rename the unzipped directory to `javafx-sdk-14`
  • Use Admin rights to copy the directory to `c:\Program Files\` or whatever

Installation of STM32CubeProgrammer:

  • Unzip the installer to `cubeprog`.
  • Run the following from an administrator PowerShell:
PS path\to\cubeprog> java -jar .\SetupSTM32CubeProgrammer-2.5.0.exe
  • To start the GUI Programmer, run the following from PowerShell:
PS path\to\STM32CubeProgrammer\bin> java --module-path "c:\Program Files\javafx-sdk-14\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar .\STM32CubeProgrammer.exe
  • To run it from the start menu without a terminal window being opened, create a file `run.vbs` in the programmers bin directory, put the following in and change the start menu's link target to this `run.vbs` file:
CreateObject("Wscript.Shell").Run "cmd /C java --module-path ""c:\Program Files\javafx-sdk-14\lib"" --add-modules javafx.controls,javafx.fxml,javafx.web -jar STM32CubeProgrammer.exe", 0, True

View solution in original post

7 REPLIES 7
Houda GHABRI
ST Employee

Hi @Pascal Rosin​ ,

Only Java 8 is supported for STM32CubeProgrammer, on windows you can use Oracle JRE 8 prior to 1.8u211(free) .

regards,

Houda

Pascal Rosin
Associate II

There is a way to run the STM32CubeProgrammer with AdoptOpenJDK 11, but you will also need to install an OpenJFX SDK. I am using JavaFX 14 from here.

Installation of OpenJFX:

  • Unzip the downloaded SDK
  • Rename the unzipped directory to `javafx-sdk-14`
  • Use Admin rights to copy the directory to `c:\Program Files\` or whatever

Installation of STM32CubeProgrammer:

  • Unzip the installer to `cubeprog`.
  • Run the following from an administrator PowerShell:
PS path\to\cubeprog> java -jar .\SetupSTM32CubeProgrammer-2.5.0.exe
  • To start the GUI Programmer, run the following from PowerShell:
PS path\to\STM32CubeProgrammer\bin> java --module-path "c:\Program Files\javafx-sdk-14\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar .\STM32CubeProgrammer.exe
  • To run it from the start menu without a terminal window being opened, create a file `run.vbs` in the programmers bin directory, put the following in and change the start menu's link target to this `run.vbs` file:
CreateObject("Wscript.Shell").Run "cmd /C java --module-path ""c:\Program Files\javafx-sdk-14\lib"" --add-modules javafx.controls,javafx.fxml,javafx.web -jar STM32CubeProgrammer.exe", 0, True

I have no "--module-path" option. Any way around this?

Using the ST tools on windows is somewhat painful because of java not being the right version.

With AdoptOpenJDK 11, your `java` command should have a `--module-path` option. If not, you have probably another java version installed and in your path. Check `java --version` it says `openjdk 11.0.8 2020-07-14` in the first line on my computer.

If you are using a Java version by Oracle, there would be no need for the `--module-path` option because JavaFX is integrated in Oracle Java, so you won't need to tell java where the JavaFX modules are to be found. With Oracle Java other than Java 8 Just try

java -jar .\STM32CubeProgrammer.exe

or maybe

java --add-modules javafx.controls,javafx.fxml,javafx.web -jar .\STM32CubeProgrammer.exe

to run the programmer.

The thing is that old JRE 8 versions are not allowed in my company due to security concerns. And for newer versions therer are licensing concerns :)

Many thanks - works brilliantly!

A different way to start without a terminal window:

cd C:\apps\STM32CubeProgrammer\bin
start "Starting STM32CubeProgrammer.." javaw --module-path "C:\apps\javafx-sdk-15\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar .\STM32CubeProgrammer.exe
 
::Optional - keep console open for a short while while loading - adjust n to match loading time
::ping 127.0.0.1 -n 4 >NULL

dchandrakanth
Associate II

Issue is fixed by adding -Djna.nosys=true in the newline in C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32CubeProgrammer.l4j.ini