rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.52k stars 1.26k forks source link

Java Runtime PATH problem under Windows (EXCEPTION_ACCESS_VIOLATION) #813

Closed dadul96 closed 3 years ago

dadul96 commented 4 years ago

This problem occurs when a second (different) Java version is installed on a windows PC (besides the one provided with the Arduino IDE). Instead of using the provided Java version of the Arduino IDE the maple_upload.bat-file uses the Java version found in the environment path (oftentimes this is a different one).

This results in the following error message:

maple_loader v0.1
Resetting to bootloader via DTR pulse
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=12532, tid=0x000000000000127c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_261-b12) (build 1.8.0_261-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.261-b12 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [jSSC-2.8_x86_64.dll+0xb5db]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Daniel\Documents\Arduino\hardware\Arduino_STM32\tools\win\hs_err_pid12532.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

To solve this problem the following line should be added to the maple_upload.bat: if exist "C:\Program Files (x86)\Arduino\java\bin" set PATH=C:\Program Files (x86)\Arduino\java\bin;%PATH%

This line temporarily changes the PATH during the execution of this batch file and ensures that the correct Java version is used.

This issue also has been discussed here.

cad435 commented 4 years ago

Happens to me too, but for PlatformIO (wich afaik directly calls java with arguments without calling the .bat file). Happened only after upgrading Java8 to newest release.

Solved by uninstalling Java8 and installing Java7 again... (Not recommended though, it is heavily outdated)

Edit: After installing Java8_u202 from https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html I'm able to upload agian with Java 8

stevstrong commented 3 years ago

I have to test the PR.

gibsonmb commented 1 year ago

However, it's not fixed. I still get this error message (or very similar) using Arduino IDE 2.03 which of course does not in itself install or use JAVA. My installed version of JAVA is; java version "1.8.0_361" Java(TM) SE Runtime Environment (build 1.8.0_361-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)

and the error message I get when trying to compile BLINK is as follows;

Sketch uses 12804 bytes (9%) of program storage space. Maximum is 131072 bytes. Global variables use 2064 bytes (10%) of dynamic memory, leaving 18416 bytes for local variables. Maximum is 20480 bytes. maple_loader v0.1 Resetting to bootloader via DTR pulse #

A fatal error has been detected by the Java Runtime Environment:

#

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=8016, tid=0x0000000000003b94

#

JRE version: Java(TM) SE Runtime Environment (8.0_361) (build 1.8.0_361-b09)

Java VM: Java HotSpot(TM) 64-Bit Server VM (25.361-b09 mixed mode windows-amd64 compressed oops)

Problematic frame:

C [jSSC-2.8_x86_64.dll+0xb5db]

#

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

#

An error report file with more information is saved as:

C:\Users\Mike\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2022.9.26\win\hs_err_pid8016.log

# hs_err_pid27268.log

I am not smart enough to know how to fix this. It looks like a bug or incorrect entry in the platfrom.txt file maybe. Or is it something to do with using 64 bit Java.

stevstrong commented 10 months ago

You should uninstall Java (JDK or JRE) for 64 bit platform and install 32 version instead. This solved the issue for me.