While uploading code to STM32F103C6t6 I get "'java' is not recognized as an internal or external command, operable program or batch file."

Using Arduino IDE to upload code to an STM32 Blue Pill. It was working back in September. I used ST Link to flash the firmware using St Link Utility. Then I connected a USB cable to the Blue Pill and plugged it into my laptop. Shows under Ports 'Maple Serial (COM9)'. I choose the board on Arduino IDE, choose STM32duino bootloader as the upload method but I get this error:

"'java' is not recognized as an internal or external command,
operable program or batch file."

Has something changed in Arduino IDE for these boards since September last? I am using 2.0.3.

I've moved your topic to the dedicated IDE2.0 section of the forum.

1 Like

Hi @asb278. I'm going to ask you to post the full output from the upload when in verbose mode.


:exclamation: NOTE: These instructions will not solve the problem. They are only intended to gather more information which might provide a clue that eventually leads to a solution.


Please do this:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Uncheck the box next to Show verbose output during: compilation
  3. Check the box next to Show verbose output during: ☐ upload.
  4. Click the OK button.
  5. Attempt an upload, as you did before.
  6. Wait for the upload to fail.
  7. You will see a "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the COPY ERROR MESSAGES button on that notification.
  8. Open a forum reply here by clicking the Reply button.
  9. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code tags icon on toolbar
  10. Press Ctrl+V.
    This will paste the error output from the upload into the code block.
  11. Move the cursor outside of the code tags before you add any additional text to your reply.
  12. Click the Reply button to post the output.
1 Like

Hello, thank you for your time.
I didnt get any error notification on bottom-right corner unfortunately. Did two things:

  1. I got this when I checked 'compile' with 'upload' unchecked:
Using board 'genericSTM32F103C6' from platform in folder: C:\Users\Developer\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26
Using core 'maple' from platform in folder: C:\Users\Developer\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26
Detecting libraries used...
"C:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOC -DERROR_LED_PIN=13 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10607 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103C6 -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103C6 -mthumb -march=armv7-m -D__STM32F1__ "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/include" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/stm32f1/include" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/usb/stm32f1" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/usb/usb_lib" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\cores\\maple" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\variants\\generic_stm32f103c" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\sketch\\Blink_copy_2.ino.cpp" -o nul
Generating function prototypes...
"C:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOC -DERROR_LED_PIN=13 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10607 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103C6 -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103C6 -mthumb -march=armv7-m -D__STM32F1__ "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/include" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/stm32f1/include" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/usb/stm32f1" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/usb/usb_lib" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\cores\\maple" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\variants\\generic_stm32f103c" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\sketch\\Blink_copy_2.ino.cpp" -o "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -std=gnu++11 -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOC -DERROR_LED_PIN=13 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10607 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103C6 -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103C6 -mthumb -march=armv7-m -D__STM32F1__ "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/include" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/stm32f1/include" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/usb/stm32f1" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\system/libmaple/usb/usb_lib" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\cores\\maple" "-IC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\variants\\generic_stm32f103c" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\sketch\\Blink_copy_2.ino.cpp" -o "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\sketch\\Blink_copy_2.ino.cpp.o"
Compiling libraries...
Compiling core...
Using previously compiled file: C:\Users\Developer\AppData\Local\Temp\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\core\wirish\start.S.o
Using previously compiled file: C:\Users\Developer\AppData\Local\Temp\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\core\wirish\start_c.c.o
Using previously compiled file: C:\Users\Developer\AppData\Local\Temp\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\core\wirish\boards.cpp.o
Using previously compiled file: C:\Users\Developer\AppData\Local\Temp\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\core\wirish\syscalls.c.o
Using previously compiled file: C:\Users\Developer\AppData\Local\Temp\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\core\wirish\boards_setup.cpp.o
Using previously compiled file: C:\Users\Developer\AppData\Local\Temp\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\core\board.cpp.o
Using precompiled core: C:\Users\Developer\AppData\Local\Temp\arduino-core-cache\core_e0adc7969d4b5e5eea5f74c57b3c84ae.a
Linking everything together...
"C:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections --specs=nano.specs -mcpu=cortex-m3 "-TC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\variants\\generic_stm32f103c/ld/bootloader_20_c6.ld" "-Wl,-Map,C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF/Blink_copy_2.ino.map" "-LC:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F1\\2022.9.26\\variants\\generic_stm32f103c/ld" -o "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF/Blink_copy_2.ino.elf" "-LC:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\sketch\\Blink_copy_2.ino.cpp.o" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\core\\board.cpp.o" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\core\\wirish\\boards.cpp.o" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\core\\wirish\\boards_setup.cpp.o" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\core\\wirish\\start.S.o" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\core\\wirish\\start_c.c.o" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF\\core\\wirish\\syscalls.c.o" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-core-cache\\core_e0adc7969d4b5e5eea5f74c57b3c84ae.a" -Wl,--end-group
"C:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF/Blink_copy_2.ino.elf" "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF/Blink_copy_2.ino.bin"

"C:\\Users\\Developer\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-size" -A "C:\\Users\\Developer\\AppData\\Local\\Temp\\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF/Blink_copy_2.ino.elf"
Sketch uses 12804 bytes (52%) of program storage space. Maximum is 24576 bytes.
Global variables use 2064 bytes (20%) of dynamic memory, leaving 8176 bytes for local variables. Maximum is 10240 bytes.
'java' is not recognized as an internal or external command,
operable program or batch file.
  1. I also unchecked 'compile' and checked 'upload' and got this:
Sketch uses 12804 bytes (52%) of program storage space. Maximum is 24576 bytes.
Global variables use 2064 bytes (20%) of dynamic memory, leaving 8176 bytes for local variables. Maximum is 10240 bytes.
"C:\Users\Developer\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2022.9.26/win/maple_upload.bat" COM9 2 1EAF:0003 "C:\Users\Developer\AppData\Local\Temp\arduino-sketch-500FD09B1ABCE59609FAE38D1A5A37BF/Blink_copy_2.ino.bin" "{runtime.ide.path}"
'java' is not recognized as an internal or external command,
operable program or batch file.

The "STM32 MCU based boards" platform uses a Java program to upload sketches to your STM32 board. The Java executable is required in order to run this program:

https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/341cd894516f747f14108de5da593dad99900ae0/tools/win/maple_upload.bat#L9

Because the Java executable is included with the Arduino IDE 1.x installation (because the Arduino IDE 1.x application is written in Java), the "STM32 MCU based boards" platform developers assume you have the Java executable available on your computer and in your system path. The Arduino IDE 2.x application is written in a different programming language so its installation does not include the Java executable. This means that in order to use the "STM32 MCU based boards" platform to upload to your board with Arduino IDE 2.x, you will need to install Java.

An alternative is to use the stm32duino boards platform instead:

https://github.com/stm32duino/Arduino_Core_STM32#getting-started

That platform does not have a dependency on Java.

I tried that but this does not include my STM32F103C6T6 board to begin with.

Are you certain? I see there is a "Generic F103C6Tx".

Since the STM32duino boards platform supports a huge number of microcontrollers and boards, it uses a board configuration system where you first select the board family from the Tools > Board > STM32 MCU based boards menu (in this case you would select "Generic STM32F1 series"), then the specific part number from the Tools > Board part number menu (in this case you would select "Generic F103C6Tx").

Thanks I did not know this. When I set Upload Method to 'Maple DFU bootloader original' I got connected, it downloaded but then COM9 got disconnected automatically and despite 2 sec delay, the LED blinks very very rapidly. This is the output:

Sketch uses 10256 bytes (31%) of program storage space. Maximum is 32768 bytes.
Global variables use 1112 bytes (10%) of dynamic memory, leaving 9128 bytes for local variables. Maximum is 10240 bytes.
Looking for port COM9.
Port name: COM9
Description: Maple Serial (COM9)
Opening port.
dfu-util - (C) 2007-2008 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=1, name="STM32duino bootloader v1.0  Upload to Flash 0x8005000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=210
Starting download: [##################################################] finished!
error resetting after download: usb_reset: could not reset device, win error: A device which does not exist was specified.


state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
Waiting for COM9 serial........................................... Timed out.
Failed uploading: uploading error: exit status 1

Then I plhugged it into STLink dongle, it connected, I uploaded the firmware. Replugged the USB and got COM9 again. Then chose Upload Method as 'Maple DFU Bootloader 2.0), this time almost same error as above, COM9 got disconnected but now finally the LED is blinking as expected. It works but I dont know how.

Sketch uses 10256 bytes (31%) of program storage space. Maximum is 32768 bytes.
Global variables use 1112 bytes (10%) of dynamic memory, leaving 9128 bytes for local variables. Maximum is 10240 bytes.
Looking for port COM9.
Port name: COM9
Description: Maple Serial (COM9)
Opening port.
dfu-util - (C) 2007-2008 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=210
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
Waiting for COM9 serial........................................... Timed out.
Failed uploading: uploading error: exit status 1

You are welcome. I'm glad if I was able to be of assistance.

As for the problems with the ports, unfortunately I'm not very knowledgeable about the STM32 boards and platforms beyond the basics of installing the platform and selecting the board in the IDE. But some of the other forum members are very knowledgeable on this subject and I'm certain they can help you with any questions or problems regarding this popular microcontroller and platform.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.