diff --git a/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.ps1 b/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.ps1 index 3aad1f117..8b09a0a5f 100644 --- a/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.ps1 +++ b/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.ps1 @@ -613,7 +613,14 @@ else else { GetJavaVersion - if ([int]$script:JavaVersion -ne [int]$RecommendedJavaVersion) + if ($script:JavaVersion -match '[0-9]+') + { + if ($script:JavaVersion -ne $RecommendedJavaVersion) + { + InstallJava + } + } + else { InstallJava } @@ -623,7 +630,7 @@ else { GetJavaVersion Write-Host "Detected $($Semantics[0]).$($Semantics[1]).$($Semantics[2]) - Java $($JavaVersion)" - if ([int]$script:JavaVersion -ne [int]$RecommendedJavaVersion) + if ($script:JavaVersion -ne $RecommendedJavaVersion) { $script:Java = "java" InstallJava diff --git a/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.sh b/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.sh index 61d30416f..9a10760e5 100644 --- a/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.sh +++ b/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_template.sh @@ -416,7 +416,11 @@ else installJava else getJavaVersion - if [[ "$JAVA_VERSION" != "$RECOMMENDED_JAVA_VERSION" ]];then + if [[ "$JAVA_VERSION" =~ [0-9]+ ]];then + if [[ "$JAVA_VERSION" != "$RECOMMENDED_JAVA_VERSION" ]];then + installJava + fi + else installJava fi fi