Re: Getting Java on path?
On Tue, May 11, 2004 at 11:48:17PM +0300, David Baron wrote:
} Needed to run .jars, etc. Installation of jdk deb made from
} Sun-supplied rpm did not take care of this. How might I set it up?
}
} Postings on this list also say I need a $JAVA_HOME directory. How do I
} set this up?
The RPM you installed placed all the Java stuff somewhere. I would guess
that it is in /usr/java. You will want to set your JAVA_HOME environment
variable to /usr/java/j2sdk<something> (look in /usr/java for the
appropriate something).
As for getting java and jar and other such Java-oriented executables in
your path, you can use the following script which puts all of the
executables and their man pages into the alternatives system.
If you run it without arguments, it will report its usage; it requires
one argument: that same JAVA_HOME directory. You can also optionally
give it the priority you want it to use for update-alternatives; if you
don't supply a priority, it will attempt to derive one from the path of
the directory you gave it.
#!/bin/sh
if test $# -lt 1 -o $# -gt 2 -o ! -d "$1"
then
echo "Usage: $0 <Java home> [priority]"
exit 1
fi
JAVA_HOME=$1
if test $# -eq 2
then
PRIORITY=$2
else
PRIORITY="`basename \"$JAVA_HOME\" | sed 's/j2sdk//' | tr -dc '[0-9]'`"
if -z "$PRIORITY"
then
PRIORITY=14000
fi
fi
MANPAGES="`ls $JAVA_HOME/man/man1/*`"
EXECUTABLES="`ls $JAVA_HOME/bin/* | grep -v 'bin/java$'`"
MANPAGES="`echo $MANPAGES | sed s,$JAVA_HOME'/man/man1/\([^ ]*\),--slave /usr/share/man/man1/\1 \1 &,g'`"
EXECUTABLES="`echo $EXECUTABLES | sed s,$JAVA_HOME'/bin/\([^ ]*\),--slave /usr/bin/\1 \1 &,g'`"
set -x
update-alternatives --install /usr/bin/java java $JAVA_HOME/bin/java \
$PRIORITY $EXECUTABLES $MANPAGES
--Greg
Reply to: