When you use the Java classpath (pre java 1.6) you have to manually list each jar on your classpath such as:

java -cp lib/database.jar:lib/commons.jar:/lib/log.jar com.joejag.Main

On Java 1.6 a little known feature is that you can now use wildcards, so the above command becomes:

java -cp lib/*.jar com.joejag.Main

I still have to use an earlier version of Java for some applications I handle. To save having to list all the jars manually I use the following bash script which allows you to automatically list all the jars in a directory:

java -cp `find lib -name *.jar -exec printf :{} ';'` com.joejag.Main