The Arduino IDE crashes whenever I try to launch it, shortly after showing the splash screen. Launching from the command line rather than the MacOS App I see an error:
$ /Applications/Arduino.app/Contents/MacOS/Arduino ... # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fff203680a9, pid=17273, tid=0x0000000000000307 # # JRE version: Java(TM) SE Runtime Environment (8.0_192-b12) (build 1.8.0_192-b12) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.192-b12 mixed mode bsd-amd64 compressed oops) # Problematic frame: # C [libsystem_platform.dylib+0x10a9] _platform_memmove$VARIANT$Haswell+0x29 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /private/tmp/hs_err_pid17273.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. #  17273 abort /Applications/Arduino.app/Contents/MacOS/Arduino
Digging through the output above the error I see that it's using an old java jdk that I have installed:
2021-02-06 00:49:27.466 Arduino[17273:226248] -> JVM Runtime path: /Applications/Arduino.app/Contents/PlugIns/jre8u252-b09.jre 2021-02-06 00:49:27.466 Arduino[17273:226248] Searching for a Java 8 virtual machine 2021-02-06 00:49:27.466 Arduino[17273:226248] Search for java VM in '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home' 2021-02-06 00:49:27.466 Arduino[17273:226248] KO - error: 'launch path not accessible' 2021-02-06 00:49:27.483 Arduino[17273:226248] Search for java VM in '/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home' 2021-02-06 00:49:27.550 Arduino[17273:226248] -> JVM Runtime path updated to: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk 2021-02-06 00:49:27.550 Arduino[17273:226248] -> Java Runtime Dylib Path: '/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre/lib/jli/libjli.dylib'
On a hunch I moved away the jdk1.8, and the problem was fixed!
However, I need this old jdk for testing some apps. Is there a way to specify the correct java path for the IDE? I tried setting JAVA_HOME and using jenv to switch versions, but the local shell variables seem to be ignored even when launching from the command line.