Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/java/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,26 @@ find_version_list() {
major_version=$(echo "$java_ver" | cut -d '.' -f 1)
fi

# Remove this hardcoded fallback as this fails for latest version released ex: 24
# Related Issue: https://github.com/devcontainers/features/issues/1308
# if [ "${JDK_DISTRO}" = "ms" ]; then
# if [ "${major_version}" = "8" ] || [ "${major_version}" = "18" ] || [ "${major_version}" = "22" ] || [ "${major_version}" = "23" ] || [ "${major_version}" = "24" ];then
# JDK_DISTRO="tem"
# fi
# fi

Comment thread
Mathiyarasy marked this conversation as resolved.
Outdated
if [ "${JDK_DISTRO}" = "ms" ]; then
if [ "${major_version}" = "8" ] || [ "${major_version}" = "18" ] || [ "${major_version}" = "22" ] || [ "${major_version}" = "23" ]; then
# Check if the requested version is available in the 'ms' distribution
echo "Check if OpenJDK is available for version ${major_version} for ${JDK_DISTRO} Distro"
available_versions=$(su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk list ${install_type} | grep ${JDK_DISTRO} | grep -oE '[0-9]+(\.[0-9]+(\.[0-9]+)?)?' | sort -u")
if echo "${available_versions}" | grep -q "^${major_version}"; then
echo "JDK version ${major_version} is available in ${JDK_DISTRO}..."
else
echo "JDK version ${major_version} not available in ${JDK_DISTRO}.... Switching to (tem)."
JDK_DISTRO="tem"
fi
fi
echo "JDK_DISTRO: ${JDK_DISTRO}"
if [ "${install_type}" != "java" ]; then
regex="${prefix}\\K[0-9]+\\.?[0-9]*\\.?[0-9]*${suffix}"
else
Expand Down
2 changes: 1 addition & 1 deletion test/java/install_latest_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo 'public class HelloWorld { public static void main(String[] args) { System.
javac HelloWorld.java

check "hello world" /bin/bash -c "java HelloWorld | grep "Hello, World!""
check "java version latest installed" grep "23" <(java --version)
check "java version latest installed" grep "24" <(java --version)

# Report result
reportResults