Follow JDK instructions from aws Link https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/generic-linux-install.html
wget -O- https://apt.corretto.aws/corretto.key | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.corretto.aws stable main'
sudo apt-get update && sudo apt-get install java-common
sudo apt-get update; sudo apt-get install -y java-17-amazon-corretto-jdk
test with java --version if If you see a version string that doesn't mention Corretto, run the following command to change the default java or javac providers.
sudo update-alternatives --config java
sudo update-alternatives --config javac
Maven 3.6.x does not work with JDK 17 , upgrade to maven 3.8.x using steps below
wget https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.3-bin.tar.gz
sudo mkdir -p /usr/local/apache-maven
sudo mv apache-maven-3.8.4-bin.tar.gz /usr/local/apache-maven
cd /usr/local/apache-maven
sudo tar -xzvf apache-maven-3.8.4-bin.tar.gz
Export to profile so the binaries are available across terminals
sudo nano ~/.bashrc
export PATH="$HOME/.jbang/bin:$PATH"
export JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto
export MAVEN_HOME=/usr/local/apache-maven/apache-maven-3.8.4
export M2_HOME=/usr/local/apache-maven/apache-maven-3.8.4
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$M2:$PATH