Build Classpath in Shell #!/bin/sh colons() { IFS=':'; echo "$*" } classpath() { colons $(echo "$1/*") } Or: echo $1/*.jar | tr ' ' ':' Java 6 and later support wildcards: java -cp "my.jar:lib/*" my.package.Main (not *.jar).