The CLASSPATH Issue [Was: java in gcc-2.95 release on Linux - not so good]
Kresten Krab Thorup
krab@gnu.org
Fri Aug 6 00:39:00 GMT 1999
Lincoln Spiteri <lincoln.spiteri@st.com> writes:
> Try unsetting your CLASSPATH (export CLASSPATH=) and recompile. That might
> help.
This CLASSPATH problem has also fooled me a couple of times, and I am
beginning to think that it would be a good idea to *not* have gcj use
that environment variable *at all*. I think many users will be having
this problem. Since gcj *needs* to work against something which is
exactly the right one, it seems much too fragile to share this
variable with other random java implementations.
For a "normal" java implementation it is not as critical, i.e., you
can compile stuff against one version of the libraries, and it will
"generally" also work with others. This will *never* be the case for
gcj, it is born with the binary compatibility problem well known from
many C++ implementations, because it relies on vtables to have a
certain layout.
I suggest, that for the compiler, it should have the default compiled
in (as it has now), and allow arguments to override the default (as it
does now), but not use the "CLASSPATH" environment variable -- perhaps
we could use "GCJ_CLASSPATH" instead.
If you really want, why don't could add an option that will enable
CLASSPATH to be read, for backwards compatibility, like:
--bogus-classpath-compatibility-with-gcc-2.95,
Something long and ugly, so noone will ever use it, and make sure it's
well hidden in the documentation.
Anyway, ...
For make files, it is most robust to use an explicit -classpath option
to the compiler. For individual command line usages, it would be
meaningful to add `--classpath-prepend', or `-cp'. Personally, I have
found that `-cp' is very useful in the case of other Java tools, and I
intend to add this to the command-line Java interpreter `gjava'.
In general I don't like to use environment variables: a small script
or a shell alias that invokes your tool with the correct and explicit
command line options is much more stable, and easy to do too.
-- Kresten
Kresten Krab Thorup, Ph.D. Candidate
c/o Yonezawa Laboratory
Department of Information Science
The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113 Japan
Fax: +81-(0)3-5689-4365
Phone: +81-(0)3-5841-4118
Mobile: +81-(0)90-3693-5715
More information about the Java
mailing list