Of particular importance, and much consternation, the class loader will load classes in the order they appear in the classpath. Starting with the first classpath entry, the class loader visits each specified directory or archive file attempting to find the class to load. The first class it finds with the proper name is loaded, and any remaining classpath entries are ignored.
Sounds simple, right?
載自:http://www.javaworld.com/javaworld/javatips/jw-javatip105.html
上面说明了,java xx -classpath ".;a.jar;b.jar;" 时,如果a.jar和b.jar有重名的类,那么会以a.jar的为准,忽略b.jar的,因为jvm按照-classpath参数的路径先后顺序去load类,后续加载的同名的类会被忽略。