After building your kernel to support binfmt_misc, cat the following line
to /proc/sys/fs/binfmt_misc/register

:Java:M::\xca\xfe\xba\xbe::/usr/local/bin/jwrapper:

and make an executable file /usr/local/bin/jwrapper containing the script
which follows :

-----BEGIN JWRAPPER-----
#!/bin/bash
# /usr/local/bin/jwrapper - the wrapper for binfmt_misc/java
CLASS=$1

# if classname is a link, we follow it (this could be done easier - how?)
if [ -L "$1" ] ; then
        CLASS=`ls --color=no -l $1 | tr -s '\t ' '  ' | cut -d ' ' -f 11`
fi
CLASSN=`basename $CLASS .class`
CLASSP=`dirname $CLASS`

FOO=$PATH
PATH=$CLASSPATH
if [ -z "`type -p -a $CLASSN.class`" ] ; then
   # class is not in CLASSPATH
   if [ -e "$CLASSP/$CLASSN.class" ] ; then
      # append dir of class to CLASSPATH
      if [ -z "${CLASSPATH}" ] ; then
         export CLASSPATH=$CLASSP
      else
         export CLASSPATH=$CLASSP:$CLASSPATH
      fi
   else
      # uh! now we would have to create a symbolic link - really
      # ugly, i.e. print a message that one has to change the setup
      echo "Hey! This is not a good setup to run $1 !"
      exit 1
   fi
fi
PATH=$FOO

shift
/opt/jdk/bin/java $CLASSN "$@"
-----END JWRAPPER-----

On Mon, 25 Jan 1999, Steve Cohen wrote:

> The file java.txt in the /usr/src/linux/documentation directory gives
> information on compiling the java kernel to provide support for running
> java binaries.  (This file is in the 2.0.36 source trees and I believe
> earlier ones as well.

---------------------------------------------------------------------------
You can't run away forever, But there's nothing wrong with getting a good
head start.  -- Jim Steinman, "Rock and Roll Dreams Come Through"
---------------------------------------------------------------------------
Ted Garrett                                    PGP Key ID: 0A04AE45
Network Systems Analyst for hire               [EMAIL PROTECTED]

Reply via email to