Skip to content

Commit

Permalink
Adding support for java 20 and minecraft 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
jzillioux committed Jun 19, 2023
1 parent eaf8464 commit 77eeae0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
28 changes: 23 additions & 5 deletions rootfs/usr/local/bin/set_java_ver
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
# (c) 2021 nimmis <[email protected]>
#
###########################################################
function set_java_20 () {
if ! [ -d /usr/lib/jvm/jdk-20* ]; then
echo "Downloading JDK 1.20"
curl -L https://github.com/adoptium/temurin20-binaries/releases/download/jdk-20%2B36/OpenJDK20U-jdk_x64_linux_hotspot_20_36.tar.gz | tar xz -C /usr/lib/jvm
fi

echo "set java version to 20"
rm -f /usr/lib/jvm/default-jvm
ln -s /usr/lib/jvm/jdk-20* /usr/lib/jvm/default-jvm

}

function set_java_18 () {
if ! [ -d /usr/lib/jvm/jdk-18* ]; then
echo "Downloading JDK 1.18"
Expand Down Expand Up @@ -39,7 +51,7 @@ function set_java_16 () {
fi

echo "set java version to 16"
rm -f /usr/lib/jvm/default-jvm
rm -f /usr/lib/jvm/default-jvm
ln -s /usr/lib/jvm/jdk-16* /usr/lib/jvm/default-jvm

}
Expand All @@ -50,8 +62,8 @@ function set_java_11 () {
curl -L https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.13%2B8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.13_8.tar.gz | tar xz -C /usr/lib/jvm
fi

echo "set java version to 16"
rm -f /usr/lib/jvm/default-jvm
echo "set java version to 11"
rm -f /usr/lib/jvm/default-jvm
ln -s /usr/lib/jvm/jdk-11* /usr/lib/jvm/default-jvm

}
Expand All @@ -68,6 +80,12 @@ function set_java_8 () {

}
case "$1" in
20)
set_java_20
;;
18)
set_java_18
;;
17)
set_java_17
;;
Expand All @@ -86,8 +104,8 @@ case "$1" in
*)
echo "set_java_ver <version>"
echo "set the java version for the container"
echo
echo "Available versions are 8, 11, 16 and 17"
echo
echo "Available versions are 8, 11, 16, 17, 18 and 20"
exit 1
;;
esac
Expand Down
12 changes: 8 additions & 4 deletions rootfs/usr/local/bin/set_mc_ver
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
###########################################################
#
# script to set correct java version for different
# script to set correct java version for different
# versions of minecraft
#
# (c) 2021 nimmis <[email protected]>
Expand All @@ -12,15 +12,19 @@ if [ $# -eq 0 ]; then
exit 1
fi

# fucntion to load correct java version
# fucntion to load correct java version

function load_java() {

case "$1" in
latest | 1.19*)
latest | 1.20*)
/usr/local/bin/set_java_ver 20
;;

1.19*)
/usr/local/bin/set_java_ver 18
;;

1.18*)
/usr/local/bin/set_java_ver 17
;;
Expand Down

0 comments on commit 77eeae0

Please sign in to comment.