-classpath /com:/foo:.
is not the same as
-classpath .:/foo:/com
They are not same.
Whenever javac or
java is invoked using
-classpath /com:/foo:.
it will look for the required classes in /com first. If not found, it goes to /foo and look for the same. If not found, it searches the current directory.
If it managed to find in /com it won't search inside /foo. Similarly, if it cannot find in /com but managed to find the class in /foo, it won't search in the current directory. Again if the class is not found in /foo, it will search in the current directory. If the class is not found in the current directory, the compilation will fail.
So in
.:/foo:/com, the sequence of searching the class file starts from current directory. If not found in the current directory, it goes to the /foo. If not found in /foo, then it look in the /com.
Again, if it managed to find in the current directory, it stops there. The process continues to /foo if the class is not available in the current directory. The /com will be searched if the class file is not available in the /foo directory. If the class file is not found in the /com directory, then the compilation will fail.
HTH.
_charles