Java Geek Trick du Jour

I’m trying to compile some sample classes to learn how to use Apache Axis the Java webservices system. Part of Java is that it needs to know where to load class libraries from. This is normally set by the CLASSPATH environment variable.
Java stores class libaries in ‘jar’ files, (java archive). Unfortunately, some apps need dozens of jar files to compile / run, and the CLASSPATH variable can only point to individual JAR files, not say “This directory full of jar files”.
So a fellow on #java suggested this:

export CLASSPATH=`echo mydir/*.jar | tr " " ":"`

Cute. Loads up the CLASSPATH variable with all the jars in a directory.

primark

About

A wandering geek. Toys, shiny things, pursuits and distractions.

View all posts by