Skip to content

Instantly share code, notes, and snippets.

@jkot
Last active August 29, 2015 14:19
Show Gist options
  • Save jkot/83fa416e159136734037 to your computer and use it in GitHub Desktop.
Save jkot/83fa416e159136734037 to your computer and use it in GitHub Desktop.
Java

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment