The -cp option to the java command

38,645

Solution 1

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.

Solution 2

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.

Share:
38,645

Related videos on Youtube

George Newton
Author by

George Newton

Updated on September 18, 2022

Comments

  • George Newton
    George Newton almost 2 years
    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.

    • Admin
      Admin over 10 years
      java -cp FILE.jar FILE.Main inputfile
    • Admin
      Admin over 10 years
      Then it isn't a command, it's an option to the java command.
    • Admin
      Admin over 10 years
      Try java -h 2>&1| grep cp.