diff --git a/src/main/kotlin/com/theapache64/stackzy/ui/feature/splash/SplashViewModel.kt b/src/main/kotlin/com/theapache64/stackzy/ui/feature/splash/SplashViewModel.kt index 4b34e43..2596d2c 100644 --- a/src/main/kotlin/com/theapache64/stackzy/ui/feature/splash/SplashViewModel.kt +++ b/src/main/kotlin/com/theapache64/stackzy/ui/feature/splash/SplashViewModel.kt @@ -66,10 +66,11 @@ class SplashViewModel @Inject constructor( } private fun checkJdk(onExist: () -> Unit) { - val isJdkExists = System.getenv("JAVA_HOME") != null - if (isJdkExists) { + try { + Runtime.getRuntime().exec("java -version"); + // jdk exists, pass callback onExist() - } else { + } catch (e: IOException) { _syncFailedMsg.value = "Ohh no! It looks like you don't have JDK installed 😥" } }