From 1cfb0e2b73d1c29c519a09123f67085fe292fb9e Mon Sep 17 00:00:00 2001 From: tpetrychyn Date: Tue, 23 Jun 2020 09:57:15 -0600 Subject: [PATCH] add java version check --- build.gradle.kts | 2 +- src/main/kotlin/controllers/CacheChooserController.kt | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 16235f2..9244c71 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "org.example" -version = "0.1.1-SNAPSHOT" +version = "0.1.1" repositories { mavenCentral() diff --git a/src/main/kotlin/controllers/CacheChooserController.kt b/src/main/kotlin/controllers/CacheChooserController.kt index 6d6f77a..1d033e3 100644 --- a/src/main/kotlin/controllers/CacheChooserController.kt +++ b/src/main/kotlin/controllers/CacheChooserController.kt @@ -71,6 +71,15 @@ class CacheChooserController @Inject constructor( @FXML private fun initialize() { + val javaVer = System.getProperty("java.version") + val majorVer = javaVer.split(".")[0].toInt() + if (majorVer < 11) { + lblErrorText.isVisible = true + lblErrorText.text = "Java version detected ($javaVer) is too low, please update Java to at least version 11." + btnLaunch.isDisable = true + return + } + val listCachesPlaceholder = Label("No downloadable caches found.") listCachesPlaceholder.isWrapText = true listCachesPlaceholder.textAlignment = TextAlignment.CENTER