Java classpath (-cp or -classpath) arguemnt in JDK 6 now supports the wildcard feature.
For example, if you want to included 3 external libraries in a bootstrap script you would have to use the following:
#!/bin/bash
libSource=/opt/lib/mysql-version.jar:/opt/lib/gwt-version.jar:/opt/lib/j2ee-version.jar
java -classpath $libSource target/myExecutableJar-version.jar
With JDK 6, it is much easier (and cleaner) to implement. So much so that a bootstrap might not be necessary.
java -classpath /opt/lib/'*' target/myExecutableJar-version.jar
1 comment:
Indeed a helpful feature. Unfortunately it doesnt work inside a manifest.mf file. For the Class-Path field you still have to write down every single dependency and cant use the wildcard.
Post a Comment