diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index 31273a60..c870c918 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -15,6 +15,7 @@ import html import zipfile import pathlib import ctypes +import subprocess from datetime import datetime from socket import gethostname from contextlib import redirect_stderr, suppress @@ -81,6 +82,20 @@ class Helpers: print(f"Import Error: Unable to load {ex.name} module") installer.do_install() + @staticmethod + def find_java_installs(): + try: + paths = subprocess.check_output( + ["/usr/bin/update-alternatives", "--list", "java"], encoding="utf8" + ) + + if re.match("^(/[^/ ]*)+/?$", paths): + return paths.split("\n") + + except Exception as e: + print("Java Detect Error: ", e) + logger.error(f"Java Detect Error: {e}") + @staticmethod def float_to_string(gbs: float): s = str(float(gbs) * 1000).rstrip("0").rstrip(".") diff --git a/main.py b/main.py index dec696d0..9e1284e9 100644 --- a/main.py +++ b/main.py @@ -224,6 +224,7 @@ if __name__ == "__main__": controller_setup_thread.join() Console.info("Crafty has fully started and is now ready for use!") + console.debug(helper.find_java_installs()) crafty_prompt.prompt = f"Crafty Controller v{helper.get_version_string()} > " if not args.daemon: