Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
java -cp FILE.jar FILE.Main inputfile 

What does the -cp option mean? For that matter, what a negative sign in front mean? I've searched everywhere and couldn't find the answer.

share|improve this question

closed as unclear what you're asking by Gilles, terdon, slm, jasonwryan, Mikel Oct 3 '13 at 1:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

There is no -cp command. Where did you see this? Copy-paste the whole line, at least, or whatever is necessary to how the context. – Gilles Oct 2 '13 at 23:58
java -cp FILE.jar FILE.Main inputfile – George Newton Oct 3 '13 at 0:00
Then it isn't a command, it's an option to the java command. – Gilles Oct 3 '13 at 0:15
Try java -h 2>&1| grep cp. – terdon Oct 3 '13 at 0:28
up vote 2 down vote accepted

The example you finally gave, -cp is a parameter to the command, which is java. Parameters are generally program-specific, in this case cp stands for Class Path, which is another location java will search to find the class files as they are needed by the program.

share|improve this answer

See this:


-classpath classpath -cp classpath

Specifies a list of directories, JAR files, and ZIP archives to search for class files. Separate class path entries with semicolons (;). Specifying -classpath or -cp overrides any setting of the CLASSPATH environment variable.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.