classpath question

Jeff Sturm
Thu Sep 14 08:33:00 GMT 2000

This is a resend (ORBS got me again):

Tom Tromey wrote:
> Jeff> A related issue is the runtime classpath.  Should programs
> Jeff> compiled by gcj also search /usr/share/gcj at runtime, or should
> Jeff> they use the same classpath as the compiler?  Right now
> Jeff> doesn't appear in the java.class.path system
> Jeff> property; we may have to fix that someday for class resources.
> I think for compiled programs it makes the most sense to not have to
> ship the .class files with the program.  To me that means we should
> have a way to compile a property file and put it into the executable.
> This subject has come up here before but it hasn't really been
> important enough for anybody to implement.

I'd really like to have it both ways.  I can see the merits of a single
monolithic executable, particularly for special targets with no
filesystem.  On the other hand, it may be impossible to determine at
compile time the complete set of resources needed for runtime, and
compiling in the entire classpath doesn't seem like the right thing to

One easy way to get compiled resources is to compile the resource data
to a memory array and define a classloader that can search the array. 
That can be done portably but will bloat the program image somewhat,
though we could compress it with zlib.  Another way is to use a special
program segment, but I don't know what is entailed with that and it
certainly won't be as portable.

Honestly I wasn't thinking that far ahead, I just want consistent
java.class.path settings from compile to runtime without manual
intervention.  It's needed for packages like Jacl that store various
program scripts in the classpath, for example.  That should be easy to

Jeff Sturm

More information about the Java mailing list