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

Re: Default functions for java wrappers?



On Sun, Jun 18, 2006 at 01:57:37PM +0200, Petter Reinholdtsen wrote:
> 
> 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.

Don't forget the "exec" like "exec $JAVACMD ...". People tend to forget
this.

> 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?

Looks great. This should be in the FAQ in java-common and in the wiki.

Cheers,
Michael
-- 
http://www.worldforge.org/



Reply to: