On the command line
is java -cp simply an abbreviation for java -classpath?
(I seem to remember they may have different behaviour but can't find explicit documentation).
They used to be different, but now they're the same (hence accepting both for compatibility). Originally, -classpath needed to have the classes.zip (Java 1.0/1.1) or rt.jar (Java 1.2+) in order to be able to function. Therefore, if you ran -classpath my.jar, it wouldn't work (since it wouldn't find java.lang.Object and friends). As a result, -cp was added which would append the classpaths/jars to the list, but not overwriting the classes.zip/rt.jar entry.
However, this behaviour changed sometime (1.4? 1.5?) so that you no longer needed to put entries on the 'system' classpath via -classpath, after which they were identical.
You could probably run commands from the 1.3 or 1.4 era (if you still have them) to verify when the change occurred.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With