I've been looking at compiling and running Java programs from the command line and I keep seeing different versions of setting the classpath: -cp vs -classpath. I want to think these are identical but can someone more knowledgeable than me confirm or refute this?
In JDK 8 and JRE 8, the version strings are 1.8 and 1.8. 0. Here are some examples where the version string is used: java -version (among other information, returns java version "1.8.
Update (March 29, 2020): Java 14 is the latest stable release and shows promising new features. BUT REMEMBER it will not offer long term support (LTS). For these reasons, LTS support editions are only recommendations for production releases including Java SE 8 and Java SE 11.
You can easily find answer by checking official documentation. From Windows or Unix versions:
The
java
command has a-cp
option that is an abbreviation for-classpath
.
They are the same. Do java -help
to see all the options. -cp and -classpath
do the same thing.
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