From ee29766db0f55b9ed3176e4c2cd5f889e8d0cfe7 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 17 Mar 2021 18:10:58 -0700 Subject: [PATCH] Better error for missing java. --- sdks/python/apache_beam/utils/subprocess_server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdks/python/apache_beam/utils/subprocess_server.py b/sdks/python/apache_beam/utils/subprocess_server.py index 018a8375c42..a7b623eb03a 100644 --- a/sdks/python/apache_beam/utils/subprocess_server.py +++ b/sdks/python/apache_beam/utils/subprocess_server.py @@ -161,6 +161,9 @@ class JavaJarServer(SubprocessServer): dict(__init__=lambda self: setattr(self, 'replacements', {})))() def __init__(self, stub_class, path_to_jar, java_arguments): + if not shutil.which('java'): + raise RuntimeError( + 'Java must be installed on this system to use this transform/runner.') super(JavaJarServer, self).__init__( stub_class, ['java', '-jar', path_to_jar] + list(java_arguments)) self._existing_service = path_to_jar if _is_service_endpoint(