9
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.

4
  • 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. Commented Oct 2, 2013 at 23:58
  • java -cp FILE.jar FILE.Main inputfile Commented Oct 3, 2013 at 0:00
  • Then it isn't a command, it's an option to the java command. Commented Oct 3, 2013 at 0:15
  • Try java -h 2>&1| grep cp.
    – terdon
    Commented Oct 3, 2013 at 0:28

2 Answers 2

6

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.

5

See this:

Quote:

-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.

Not the answer you're looking for? Browse other questions tagged .