[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Default functions for java wrappers?



Would it be an idea to make some default functions available for java
application wrappers?  I mean some function library available in
java-common or similar, to be used like this:

  #!/bin/sh
  . /usr/share/java-common/some-file
  [ "$DESTDIR" ] || DESTDIR=
  find_java_runtime
  $JAVACMD $JAVA_ARGS \
    -cp $DESTDIR/usr/share/java/batik-all.jar
    org.apache.batik.apps.ttf2svg.Main $@

This would hide all the complexity of selecting the java runtime away
from the wrappers, and make it easier to write wrappers.

The function could look something like this:

  # Use JAVACMD if it is set.  If not, check JAVA_HOME, and fall back to
  # 'java' if both are unset.
  find_java_runtime() {
    if [ -z "$JAVACMD" ] && [ "$JAVA_HOME" ] ; then
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    [ "$JAVACMD" ] || JAVACMD=java
    [ "$JAVA_ARGS" ] || JAVA_ARGS=
  }

Is this a good idea?  Should we implement it?  In which package, and
which file?

Friendly,
-- 
Petter Reinholdtsen



Reply to: