[java-policy] 69/198: [java-wrappers.sh] Export a decent JAVA_HOME, idea taken from #404728
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Wed Sep 23 07:49:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository java-policy.
commit 52618c5d67b2daa579864863d022e86c841a6d73
Author: Vincent Fourmond <fourmond at debian.org>
Date: Sat Jan 12 01:31:43 2008 +0000
[java-wrappers.sh] Export a decent JAVA_HOME, idea taken from #404728
---
wrappers/java-wrappers.sh | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/wrappers/java-wrappers.sh b/wrappers/java-wrappers.sh
index 27d50cd..01c3199 100644
--- a/wrappers/java-wrappers.sh
+++ b/wrappers/java-wrappers.sh
@@ -232,6 +232,13 @@ run_java() {
java_warning "No JAVA_CMD set for run_java, falling back to JAVA_CMD = java"
JAVA_CMD=java
fi
+ # We try to conjure up a JAVA_HOME from JAVA_CMD, if the former
+ # is absent. Idea coming from bug #404728.
+ if [ -z "$JAVA_HOME" ]; then
+ full_cmd_path="$(readlink -f `which $JAVA_CMD`)"
+ JAVA_HOME="${full_cmd_path:bin/*}"
+ java_debug "Using JAVA_CMD to find JAVA_HOME = '$JAVA_HOME'"
+ fi
if [ "$FORCE_CLASSPATH" ]; then
java_debug "Using imposed classpath : FORCE_CLASSPATH = '$FORCE_CLASSPATH'";
cp="-classpath $FORCE_CLASSPATH";
@@ -240,13 +247,16 @@ run_java() {
else
cp="";
fi
+ # Exporting JAVA_HOME, I guess it can't hurt much, can it ?
+ export JAVA_HOME
java_debug "Environment variable CLASSPATH is '$CLASSPATH'"
java_debug "Runnning $JAVA_CMD $JAVA_ARGS $cp $@"
exec $JAVA_CMD $JAVA_ARGS $cp "$@"
}
# Runs a java jar.
-# You don't have to use this function.
+# You don't have to use this function to run a jar, but you might find
+# it useful, though.
run_jar() {
if [ "$looked_for_jars" ];
java_warning "It is most likely useless to use find_jar when running"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/java-policy.git
More information about the pkg-java-commits
mailing list