stm32duino / Arduino_Tools

Contains upload tools for STM32 based boards
Other
87 stars 63 forks source link

"'java' is not recognized" error with Arduino 2.0.3 and maple 2 uploader #88

Closed clawsoon closed 1 year ago

clawsoon commented 1 year ago

I just installed Arduino 2.0.3 and attempted to upload to a previously working Generic STM32F1 (Blue Pill) board using Maple DFU Bootloader 2.0. I got the error:

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

I assume this error is related to the fact that Arduino is no longer built on Java.

I tried to install my own Java version, but then I got the error reported in this previous bug:

https://github.com/stm32duino/Arduino_Tools/issues/67

Any hints, fixes or workarounds would be appreciated.

Thanks.

fpistm commented 1 year ago

Hi @clawsoon unfortunately, I've no easy solution. This kind of uploader was provided for legacy wqith roger's core. I gues it is the same issue with it. You can edit the script and force to call the java from arduino 1.8.x with full path.

As stated in #67, the best solution would be to implement a small binary to perform the uart stuff like that we could remove this .jar. Else I will simply remove this upload method and mark it as deprecated and no more suported.

clawsoon commented 1 year ago

Hi @fpistm I tried it with Arduino 1.8.19 and got the error:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at CliTemplate.CliMain.main(CliMain.java:33) timeout waiting for 2 serial

Poking around, it sounds like it needs a very specific Java version (maybe from an even older Arduino IDE?)

What alternate upload method would you recommend? I don't have an STLink, just a USB cable, and some Blue Pills with the Maple stuff on them. I don't know exactly what I'm doing; I just don't want to brick my boards. :-)

fpistm commented 1 year ago

Try to edit this line: https://github.com/stm32duino/Arduino_Tools/blob/main/win/maple_upload.bat#LL8C11-L8C11

and give the full path of the java bin of your Arduino IDE 1.8.19 ex: C:\IDE\arduino-1.8.19\java\bin\java -jar maple_loader.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

clawsoon commented 1 year ago

Would the HID bootloader be a more future-proof option? Or would it just not work at all for me?

clawsoon commented 1 year ago

Installing 1.8.19 seems to have screwed up my drivers somehow, so now I'm heading down a completely different rabbit hole. Once that's sorted, I'll let you know if your java path workaround works.

Thanks.

fpistm commented 1 year ago

HID could be an option

clawsoon commented 1 year ago

I got the upload working again using an old install_drivers.bat that uses wdi-simple.exe. Your 1.8.19 java suggestion seems to have worked, though if anyone is reading this in the future I'd suggest installing 1.8.19 before installing 2.0.X, to hopefully avoid the driver issues I experienced.

Thanks for your help, @fpistm .

fpistm commented 1 year ago

I close this one as it is the same subject than #67. Fix would be to remove the .jar.