I am currently studying for the OCP Java 11 certification and I am currently playing around with the basic JDK commands.
In the study guide there's a review question mentioning that the jar
command also supports the -cp
option (the classpath). Is this true? I am not aware of such thing, neither did I find the information in the official docs.
I know about the -C
option, mentioning the path where the files to archive are located. Also, java
and javac
do accept -cp
.
I am starting to believe it is an error in the study guide, but I wanted to double check first.
Is this valid?
jar -cf newJar.jar -cp /sample/dir .
This surely is:
jar -cf newJar.jar -C /sample/dir .
If the classpath parameter is indeed valid, what's the difference between -cp and -C? I am a bit confused.
Thanks.