Add this to your ~/.bashrc , ~/.zshrc , or ~/.profile file:

sudo apt update sudo apt install openjdk-17-jdk Many Java tools (Maven, Gradle, Tomcat) rely on the JAVA_HOME variable. The Windows .msi installer often sets this automatically. Check using:

Compile and run: