Skip to content

Commit 06d4730

Browse files
committed
Proper-mac-fix
1 parent d283ed4 commit 06d4730

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ccmlib/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ def make_cassandra_env(install_dir, node_path, update_conf=True, hardcode_java_v
402402
raise ArgumentError(f"java-{hardcode_java_version} wasn't found in {jvm_root_path}")
403403

404404
env['JAVA_HOME'] = str(java_home_path.as_posix())
405+
elif env['CUSTOM_JAVA_HOME'] == '__USE_JAVA_IN_PATH__':
406+
# Cassandra starting script will use java from PATH, when JAVA_HOME is not set
407+
# See: https://github.com/apache/cassandra/blob/8974fdb821db6b72eac5a34d96fe1f78ead3c11f/redhat/cassandra.in.sh#L103-L117
408+
# When running on MacOS with Temurin, java binary fails to run correctly when JAVA_HOME is set to path that does not contain java binary
409+
# Cassandra on the other hand expects JAVA_HOME to be set to a valid JDK path (with the binary being in the bin/java file).
410+
# This means, that in this specific case, we cannot set JAVA_HOME at all.
411+
pass
405412
else:
406413
env['JAVA_HOME'] = env['CUSTOM_JAVA_HOME']
407414
version = get_jvm_spec_version(pathlib.Path(env['JAVA_HOME']) / 'bin' / 'java')

0 commit comments

Comments
 (0)