Skip to content

Commit 404e152

Browse files
authored
Add JDK path (#2069)
1 parent 9fed6a0 commit 404e152

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

scripts/entrypoint.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ set -e
55
readonly PULSARCTL_HOME=${PULSARCTL_HOME:-"/pulsarctl"}
66
readonly TEST_ARGS=${TEST_ARGS:-""}
77

8+
function ensureJavaInPath() {
9+
if command -v java >/dev/null 2>&1; then
10+
return
11+
fi
12+
13+
for dir in \
14+
/opt/jvm/bin \
15+
/opt/java/openjdk/bin \
16+
/usr/local/openjdk-17/bin \
17+
/usr/local/openjdk-11/bin \
18+
/usr/lib/jvm/default-jvm/bin \
19+
/usr/lib/jvm/java-17-openjdk/bin \
20+
/usr/lib/jvm/java-11-openjdk/bin
21+
do
22+
if [[ -x "${dir}/java" ]]; then
23+
export PATH="${dir}:${PATH}"
24+
export JAVA_HOME="${dir%/bin}"
25+
return
26+
fi
27+
done
28+
29+
echo "java executable not found in PATH or common JDK locations"
30+
exit 1
31+
}
32+
833
function checkFunctionWorker() {
934
failed=0
1035
until curl --silent localhost:8080/admin/v2/persistent/public/functions/coordinate/stats; do
@@ -20,6 +45,7 @@ function checkFunctionWorker() {
2045
}
2146

2247
pushd ${PULSARCTL_HOME}
48+
ensureJavaInPath
2349
# startup pulsar service
2450
scripts/pulsar-service-startup.sh
2551

0 commit comments

Comments
 (0)