java-common proposal: whichjava (not findjava)
Okay. I have a new proposal for java-common, namely the scripts
/usr/bin/whichjava and /usr/bin/whichjavac.
What these do is take the given Java interpreter/compiler and spit out
properties such as which variant they represent (jikes, kaffe, whatever) and
where the bootstrap classes are.
I assume here that /usr/bin/java and /usr/bin/javac are links to some random
interpreter/compiler respectively, a la the alternatives system. Bear in
mind here that different compilers have different subtleties, different
levels of completeness and use different bootstrap classpaths.
The script whichjava can be used to:
- determine the particular JVM being used; for instance, jython will not run
under ORP. This script is used to determine what /usr/bin/java really links
to, and if it turns out to be ORP then the user is given a polite message
explaining the problem and giving instructions on how to force jython to use
a different JVM. The alternative being that /usr/bin/java is run blindly and
the person using ORP gets a flood of indecipherable error messages upon
- Determine the bootstrap classpath for other utilities that need it, such as
jikes. Jython comes with jythonc which compiles .py to .class, and it uses a
Java compiler along the way. It needs to hide the details from the user, and
if /usr/bin/javac is actually jikes (which one presumes is possible since
jikes provides java-compiler) then jythonc needs to hand it a bootstrap
classpath. This is highly dependent on the installed JVM, and it uses
whichjava on /usr/bin/java to sort this out.
These are examples of using the scripts with jython, but they seem small and
general enough that they may be worth placing in java-common. Either way I'd
like a consensus on this, because if they're not going in java-common then
I'll package them separately.
I hope this removes Andrew's objections to the previous incarnation of these
scripts (findjava and findjavac), since they no longer hunt for binaries but
instead you have to supply them on the command line. i.e. they can't be used
to guess a runtime/compiler to use, but instead they are used to determine
properties of the standard runtime/compiler that is installed.
The scripts are up at:
email@example.com | firstname.lastname@example.org
Public Key: finger email@example.com
Mr Deputy Speaker, am I to be continually abused by the Honorable Member for
Mitchell and the drone beside him, the Honorable Member for Braddon ?
- Paul Keating