sudo apt update
sudo apt install openjdk-17-jdk -y
java --version
sudo update-alternatives --config java
Follow the prompts to select Java 17 (or higher).

gradle -v
If gradle is installed then follow the following steps to remove the exsisting gradle -
sudo apt remove gradle -y
First check if SDKMAN is installed: