How to install arduino IDE on Raspberry Pi 5?

I selected: 'Legacy IDE (1.8.19)Download a legacy version of the Arduino IDE.' then 'Linux Arm 64 bits', download and ran sudo /home/front-cam/arduino-1.8.19/install.sh in terminal. Everything seemed to install ok.
After: '/home/front-cam/arduino-1.8.19/arduino
' i get error message: 'f

ront-cam@front-cam:~ $ /home/front-cam/arduino-1.8.19/arduino
/home/front-cam/arduino-1.8.19/arduino: line 35: /home/front-cam/arduino-1.8.19/java/bin/java: cannot execute: required file not found
front-cam@front-cam:~ $

i run: 'sudo apt install openjdk-17-jre' and use 'nano /home/front-cam/arduino-1.8.19/arduino' to comment out the following:

'JAVA=java
# if [ -x "$APPDIR/java/bin/java" ]; then
#   JAVA=$APPDIR/java/bin/java
# fi'

Error continues to be:

'front-cam@front-cam:~ $ /home/front-cam/arduino-1.8.19/arduino
/home/front-cam/arduino-1.8.19/arduino: line 35: /home/front-cam/arduino-1.8.19/java/bin/java: cannot execute: required file not found
front-cam@front-cam:~ $

'
What should i be doing to install the Arduino IDE correctly?
Many thanks.

Open a terminal.

sudo apt install arduino/oldstable

Menu → Programming

download PiApps, which you should have for many reasons. click on Arduino IDE, done

I can’t get the ESP32 board manager to load on a Pi 5

I installed the ESP32 boards thru the board manager.

Open board manager.

Search for esp32.

install ESP32.

Takes a while.