On Tue, 6 Jun 2006, Michael Torrie wrote:
On Tue, 2006-06-06 at 21:19 -0600, Russel Caldwell wrote:
Hi,
Can somebody give me a shell script that will load multiple jar files into
the CLASSPATH variable?

This code puts all jar files in the current directory into the class
path.  This does not take into account the fact that CP will have a
leading ':'.  If you implement a simple flag variable you can eliminate
that.  I'll leave that as an exercise for the reader.  In fact this
whole question should have been an exercise for the reader.  It should
be trivial to have it use only a specific set of jar files.

Also note that if you're just trying to get all the jar files in a given directory into your classpath, there's an easier way:

java -Djava.ext.dirs=/path/to/directory MyClass

All the jars in /path/to/directory will automatically be picked up by Java. (See http://www.yoda.arachsys.com/java/extensions.html for example.)

        ~ Ross

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to