classpath question
Jeff Sturm
jeff.sturm@commerceone.com
Thu Sep 14 09:30:00 GMT 2000
Tom Tromey wrote:
> You can already set java.class.path at link time with -D.
True, but java.class.path is a system property. If I override it I can't expect
the classloader to honor it, any more than I should expect
System.getProperties().put("user.dir", "/") to change my working directory.
> Maybe we
> should set the default in the compiler at link time? Would that be
> sufficient?
I think so. The command
$ gcj -Djava.class.path=/tmp CPTest.java --main=CPTest -o cptest
just happens to do that. It also checks CLASSPATH at runtime and prepends it,
e.g.:
$ CLASSPATH=/usr/share/java ./cptest
classpath = /usr/share/java:/tmp
$ ./cptest
classpath = /tmp
Note libgcj.zip is absent, which seems wrong to me.
Ideally, I'd just like the gcj --classpath arg to persist in the compiled
executable, in other words:
$ gcj --classpath=/tmp ...
would effectively do:
$ gcj -Djava.class.path=/tmp --classpath=/tmp ...
Later we could add some option to compile selected resources into the program
image. I'm undecided whether it still makes sense to check the environment
(i.e. CLASSPATH) in that case.
--
Jeff Sturm
jeff.sturm@commerceone.com
More information about the Java
mailing list