What is the difference between `-classpath` and `-cp` in the command line?

Responsive Ad Header

Question

Grade: Education Subject: Support
What is the difference between `-classpath` and `-cp` in the command line?
Asked by:
74 Viewed 74 Answers

Answer (74)

Best Answer
(269)
Both `-classpath` and `-cp` are equivalent command-line arguments used to specify the classpath. `-classpath` is the older, more verbose form, while `-cp` is a shorthand for it. They both achieve the same result: telling the JVM where to find your class files and JARs.