diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 7a9f48d..4b864d6 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -36,6 +36,21 @@ def get_root_dir(): head, tail = os.path.split(__file__) return head +def get_java_bin_from_which(): + # Check if 'which' command is available + try: + subprocess.check_output(['source', '~/.bashrc', '&&', 'which', 'java']) + except (subprocess.CalledProcessError, FileNotFoundError): + return None + + # Run 'which java' command to get the Java binary path + try: + output = subprocess.check_output(['source', '~/.bashrc', '&&', 'which', 'java'], encoding='utf-8') + java_bin_path = output.strip() + except subprocess.CalledProcessError: + return None + + return java_bin_path def get_java_bin_path(): # Check if the 'java' command is available in the system path @@ -52,6 +67,10 @@ def get_java_bin_path(): java_bin_path = bin_path break + if java_bin_path is None: + java_bin_path = get_java_bin_from_which() + + print("java_bin_path: ", java_bin_path) return java_bin_path diff --git a/pyproject.toml b/pyproject.toml index 853e74b..f154c6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pygeoweaver" -version = "0.6.10" +version = "0.6.11" authors = [ { name="Geoweaver team", email="geoweaver.app@gmail.com" }, ] @@ -22,7 +22,7 @@ classifiers = [ [tool.poetry] name = "pygeoweaver" -version = "0.6.10" +version = "0.6.11" description = "This is a wrapper package of the Geoweaver app." authors = ["Geoweaver team "] readme = "README.md"