https://github.com/Waxes27/Scripts/blob/96605609383aeaff71a8bda3cbf8f9d93118f931/java_setup.sh#L32 Have a look at using sdkman :)