package my.
package;
import org.
whatever.
*;
import org.
whateverElse.
*;
// you can end up with a lot of jarfile dependancies
public class MyClass
{
public static void main
(String[] args
) throws Exception {
// ... code uses whatever & classloader needs those jarfiles
}
}
Normally, you would run it like
this:
java -cp c:\foo\lib\whatever.
jar;c:\foo\lib\whateverElse.
jar ...
my.
package.
MyClass [args
]
This can get tedious listing every jarfile, especially
if they are all in the same directory anyway.
I've always thought you should just be able to say -cp c:\lib\*.jar. That doesn't work, but here
's how to get the same effect:
java -Djava.ext.dirs=c:\foo\lib my.package.MyClass [args]
There are drawbacks to using this technique in production systems, but it's nice for quick development. You can also list more than one directory, separated like CLASSPATH elements with either : or ;.