Wednesday, May 27, 2009

Add jars in a directory to classpath

I happened to know this trick of easy classpath configuration when we need to add all jar files in a given directory.

There a system property "java.ext.dirs" that can be used. We can set either a relative path :


java -Djava.ext.dirs=lib com.mydomain.MyClass


or a fully qualified path to the directory:
java -Djava.ext.dirs=C:/abc/lib com.mydomain.MyClass

No comments:

Post a Comment