--- /dev/null
+#!/usr/bin/python
+
+import os
+import subprocess
+import sys
+
+def usage():
+ print >>sys.stderr, "classpath_builder takes a directory, and returns \
+the CLASSPATH environment variable that would give you access to all the \
+jars in or under that directory.\n"
+ print >>sys.stderr, "Usage: classpath_builder.py [directory-name]"
+
+if (len(sys.argv) == 1):
+ usage()
+ sys.exit(1)
+if (sys.argv[1] == "-h") or (sys.argv[1] == "--help"):
+ usage()
+ sys.exit(0)
+if (not os.path.exists(sys.argv[1])):
+ usage()
+ sys.exit(1)
+proc = subprocess.Popen(["find", sys.argv[1], "-name", "*.jar"], \
+ shell=False, stdout=subprocess.PIPE)
+data = proc.communicate()[0]
+lines = data.splitlines()
+sep=""
+outs=":".join(lines)
+print "CLASSPATH=\"$CLASSPATH:" + outs + "\""