A file system for organising java stuff ? (fwd)
Michael Koehne
kraehe at bakunin.north.de
Mon Jan 18 18:26:23 PST 1999
Moin Brian Jones,
> If it is an issue you feel you can resolve, patch the Linux kernel and
> submit the changes.
But when I first read about this java binary for linux patch I thought :
Who needs this ?
There is a much simpler way to implement java invocation from shell
or system command. Use a symlink pointing to a launcher, that's using
an .rc file to launch the application.
Lets say :
$ ln -s /usr/local/bin/jlaunch /opt/bin/sun.tools.javac.Main
or
$ ln -s /usr/local/bin/jlaunch /usr/local/bin/pizza.compiler.Main
and anything can be handled by the a simple program checking argv[0]
and knowning, that Pizza is Kaffe while Sun.Tool requires JDK, by
using an .jlaunchrc file. The second way would be using the #! syntax
for jlaunch, so jlaunch itself has some scripting ability, perhaps
even invocing Pizza itself by :
$ echo '#!/usr/local/bin/jlaunch pizza.compiler.Main' \
>/usr/local/bin/pizza
$ chmod a+x /usr/local/bin/pizza
The beauty of this approach is, that is dosnt change UNIX, and works
on most Unix look like systems.
The main problem with Java development is: Write once, die everywhere.
I've tested my programs with quite a lot of different environments, and
allways had some trouble with the next one. Attached is a file containing
my shell scripts for launching java and javac. Its controlled by some
magic environment variables, and very usefull for regession tests.
You may wonder about the LD_DLD_KAFFE path, I need it because of a.out
and dld linking - with a bit of autoconfigure, this scripts could be
an improvement over the java and javac scripts Kaffe has to offer.
Perhaps I'm an MCC oldhard, who's kernel is out of date because I'm
trying to beat our servers uptime with my homecomputer - never touch
a running system. Its quite interesting, that is was possible to install
elf and netscape 4.0 without rebooting on a Linux 1.2.13 a.out system.
Its possible to have a Sun or an IBM server with a long uptime, but this
can be compared to install some Solaris2.7 binaries on an old SunOs4.1.4.
A java launcher as described above would be nice, perhaps I write one
when I find some time.
Bye Michael
--
mailto:kraehe at bakunin.north.de UNA:+.? 'CED+2+:::Linux:1.2:13'UNZ+1'
http://human.is-bremen.de/~kraehe CETERUM CENSEO MSDOS ESSE DELENDAM
#------------------------------------------------------------------------------#
echo File bin/java
sed '/^X/s///' > bin/java << '/'
X#! /bin/sh
X
X[ -z "$JX" ] && JX=jdk
X[ -z "$CLASSPATH" ] && CLASSPATH=.
X
X[ "$JX" = net2 ] && {
X export XNLSPATH=/usr/local/netscape/nls
X export XKEYSYMDB=/usr/lib/X11/XKeysymDB
X export MOZILLA_HOME=/opt/netscape
X
X export CLASSPATH=$CLASSPATH:/usr/local/share/java/classes.moz2_0.zip
X
X [ ! "$JV" = "" ] && {
X echo using netscape2 as java >&2
X echo CLASSPATH=$CLASSPATH >&2
X }
X
X /usr/local/netscape/netscape -java $*
X exit 0
X }
X[ "$JX" = net4 ] && {
X export MOZILLA_HOME=/opt/netscape
X export LD_ELF_LIBRARY_PATH=/lib/elf
X
X export CLASSPATH=$CLASSPATH:/opt/netscape/java/classes/java40.jar
X
X [ ! "$JV" = "" ] && {
X echo using netscape4 as java >&2
X echo CLASSPATH=$CLASSPATH >&2
X }
X
X /opt/netscape/netscape -java $*
X exit 0
X }
X[ "$JX" = kaffe ] && {
X export KAFFEHOME=/usr/local/share/kaffe
X export LD_DLD_KAFFE=/usr/lib/libm.a:/usr/lib/libc.a
X export LD_LIBRARY_PATH=/usr/local/lib
X
X export CLASSPATH=$CLASSPATH:/usr/local/share/kaffe/classes.zip
X
X [ ! "$JV" = "" ] && {
X echo using kaffe as java >&2
X echo KAFFEHOME=$KAFFEHOME >&2
X echo CLASSPATH=$CLASSPATH >&2
X echo LD_DLD_KAFFE=$LD_DLD_KAFFE >&2
X echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH >&2
X }
X
X kaffe $*
X exit 0
X }
X[ "$JX" = biss ] && {
X export KAFFEHOME=/usr/local/share/kaffe092
X export LD_DLD_KAFFE=/usr/X11R6/lib/libXmu.a:/usr/X11R6/lib/libXext.a:/usr/lib/libX11.a:/usr/lib/libm.sa:/usr/lib/libc.sa
X export CLASSPATH=$CLASSPATH:/usr/local/share/kaffe092/biss:/usr/local/share/kaffe092/classes.zip
X export LD_LIBRARY_PATH=/usr/local/lib
X
X
X [ ! "$JV" = "" ] && {
X echo using biss as java >&2
X echo KAFFEHOME=$KAFFEHOME >&2
X echo CLASSPATH=$CLASSPATH >&2
X echo LD_DLD_KAFFE=$LD_DLD_KAFFE >&2
X echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH >&2
X }
X
X kaffe092 $*
X exit 0
X }
X[ "$JX" = jdk ] && {
X export JAVA_HOME=/opt/jdk1.1.3
X export LD_ELF_LIBRARY_PATH=$JAVA_HOME/lib/i486/green_threads:/lib/elf
X
X export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
X
X [ ! "$JV" = "" ] && {
X echo using jdk as java >&2
X echo JAVA_HOME=$JAVA_HOME >&2
X echo CLASSPATH=$CLASSPATH >&2
X echo LD_ELF_LIBRARY_PATH=$LD_ELF_LIBRARY_PATH >&2
X }
X
X /opt/jdk1.1.3/bin/i486/green_threads/java $*
X exit 0
X }
X[ "$JX" = jns ] && {
X export JAVA_HOME=/opt/jdk1.1.3
X export LD_ELF_LIBRARY_PATH=$JAVA_HOME/lib/i486/green_threads:/lib/elf
X
X export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
X
X [ ! "$JV" = "" ] && {
X echo using jns as java >&2
X echo JAVA_HOME=$JAVA_HOME >&2
X echo CLASSPATH=$CLASSPATH >&2
X echo LD_ELF_LIBRARY_PATH=$LD_ELF_LIBRARY_PATH >&2
X }
X
X /opt/jdk1.1.3/bin/i486/green_threads/java_ns $*
X exit 0
X }
X
Xecho NO java for engine $JX
Xexit 1
/
chmod a+x bin/java
echo File bin/javac
sed '/^X/s///' > bin/javac << '/'
X#! /bin/sh
X
X[ -z "$JC" ] && JC=jns
X
X[ "$JC" = guavac ] && {
X# echo using guavac as java >&2
X
X [ -z "$CLASSPATH" ] &&
X export CLASSPATH=.:/usr/local/share/java/classes.sun1_13.zip
X echo CLASSPATH=$CLASSPATH
X
X exec guavac $*
X }
X[ "$JC" = net2 ] && {
X# echo using netscape 2.0 as java >&2
X
X export XNLSPATH=/usr/local/netscape/nls
X export XKEYSYMDB=/usr/lib/X11/XKeysymDB
X export MOZILLA_HOME=/opt/netscape
X
X [ -z "$CLASSPATH" ] &&
X export CLASSPATH=.:/usr/local/share/java/classes.sun1_0.zip
X
X exec /usr/local/netscape/netscape -java sun.tools.javac.Main $*
X }
X[ "$JC" = kaffe ] && {
X# echo using kaffe as java >&2
X
X export KAFFEHOME=/usr/local/share/kaffe
X export LD_DLD_KAFFE=/usr/lib/libm.a:/usr/lib/libc.a
X export LD_LIBRARYPATH=/usr/local/lib
X
X [ -z "$CLASSPATH" ] &&
X export CLASSPATH=.:/usr/local/share/kaffe/Klasses.jar:\
X /usr/local/share/kaffe/pizza.jar:.
X
X exec kaffe sun.tools.javac.Main $*
X }
X[ "$JC" = jdk ] && {
X# echo using jdk 1.1.3 as java >&2
X
X export JAVA_HOME=/opt/jdk1.1.3
X export LD_ELF_LIBRARY_PATH=$JAVA_HOME/lib/i486/green_threads:/lib/elf
X
X [ -z "$CLASSPATH" ] &&
X export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
X
X exec /opt/jdk1.1.3/bin/i486/green_threads/java sun.tools.javac.Main $*
X }
X[ "$JC" = jns ] && {
X# echo using dynamic jdk 1.1.3 as java >&2
X
X export JAVA_HOME=/opt/jdk1.1.3
X export LD_ELF_LIBRARY_PATH=$JAVA_HOME/lib/i486/green_threads:/lib/elf
X
X [ -z "$CLASSPATH" ] &&
X export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
X
X exec /opt/jdk1.1.3/bin/i486/green_threads/java_ns sun.tools.javac.Main $*
X }
X
Xecho no javac for engine $JC
/
chmod a+x bin/javac
More information about the kaffe
mailing list