This is an automated email from the ASF dual-hosted git repository.
SteNicholas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git
The following commit(s) were added to refs/heads/main by this push:
new 2d5098b5e [CELEBORN-2339] Add tools.jar into classpath only for Java 8
2d5098b5e is described below
commit 2d5098b5ef9f864a0b3aafcd8e06be3b4faf42b0
Author: Cheng Pan <[email protected]>
AuthorDate: Wed May 27 12:58:21 2026 +0800
[CELEBORN-2339] Add tools.jar into classpath only for Java 8
### What changes were proposed in this pull request?
This is an enhancement of CELEBORN-1682, limit the `tools.jar` injection
only for Java 8.
### Why are the changes needed?
https://docs.oracle.com/en/java/javase/17/migrate/migrating-jdk-8-later-jdk-releases.html
> Class and resource files previously stored in lib/rt.jar, lib/tools.jar,
lib/dt.jar and various other internal JAR files are stored in a more efficient
format in implementation-specific files in the lib directory.
### Does this PR resolve a correctness bug?
- [ ] Yes
### Does this PR introduce _any_ user-facing change?
- [ ] Yes
### How was this patch tested?
Ensure the warning has gone on JDK 17.
```
"WARNING: cannot locate tools.jar. Expected to find it in either
/opt/openjdk-17/lib/tools.jar or /opt/openjdk-17/../lib/tools.jar"
```
Closes #3703 from pan3793/CELEBORN-2339.
Authored-by: Cheng Pan <[email protected]>
Signed-off-by: SteNicholas <[email protected]>
---
bin/celeborn-class | 2 ++
sbin/load-celeborn-env.sh | 17 ++++++++++-------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/bin/celeborn-class b/bin/celeborn-class
index ad1f9087e..bf73e3561 100755
--- a/bin/celeborn-class
+++ b/bin/celeborn-class
@@ -76,6 +76,8 @@ if [ ! -d "$CELEBORN_JARS_DIR" ]; then
echo "Failed to find CELEBORN jars directory ($CELEBORN_JARS_DIR)." 1>&2
echo "You need to build CELEBORN with the target \"package\" before running
this program." 1>&2
exit 1
+elif [ -z "$JAVA_TOOLS_JAR" ]; then
+ CELEBORN_CLASSPATH="$CELEBORN_CONF_DIR:$HADOOP_CONF_DIR:$CELEBORN_JARS_DIR/*"
else
CELEBORN_CLASSPATH="$CELEBORN_CONF_DIR:$HADOOP_CONF_DIR:$CELEBORN_JARS_DIR/*:$JAVA_TOOLS_JAR"
fi
diff --git a/sbin/load-celeborn-env.sh b/sbin/load-celeborn-env.sh
index e18ce2942..0d3793fe1 100755
--- a/sbin/load-celeborn-env.sh
+++ b/sbin/load-celeborn-env.sh
@@ -51,14 +51,17 @@ else
fi
fi
-# Find the java tools.jar
-if [ -f "${JAVA_HOME}/lib/tools.jar" ]; then
- export JAVA_TOOLS_JAR="${JAVA_HOME}/lib/tools.jar"
-else
- if [ -f "${JAVA_HOME}/../lib/tools.jar" ]; then
- export JAVA_TOOLS_JAR="${JAVA_HOME}/../lib/tools.jar"
+JAVA_VERSION=$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+if [[ "$JAVA_VERSION" = 1.8.* ]]; then
+ # Find the java tools.jar when using Java 8
+ if [ -f "${JAVA_HOME}/lib/tools.jar" ]; then
+ export JAVA_TOOLS_JAR="${JAVA_HOME}/lib/tools.jar"
else
- echo "WARNING: cannot locate tools.jar. Expected to find it in either
${JAVA_HOME}/lib/tools.jar or ${JAVA_HOME}/../lib/tools.jar"
+ if [ -f "${JAVA_HOME}/../lib/tools.jar" ]; then
+ export JAVA_TOOLS_JAR="${JAVA_HOME}/../lib/tools.jar"
+ else
+ echo "WARNING: cannot locate tools.jar. Expected to find it in either
${JAVA_HOME}/lib/tools.jar or ${JAVA_HOME}/../lib/tools.jar"
+ fi
fi
fi