Daniel Daniel - 5 months ago 29
Java Question

Setting the java classpath: -cp vs -classpath in JDK versions 1.0 through 1.8?

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?

Answer

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.