• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

why -cp -classpath

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK -cp is a convenient one but why -classpath ?
Is there any reason behind two options that do the same thing?
For java

For javac

Also why javac is not consistent with -cp according to K&B


Finally, the java command allows you to abbreviate -classpath with -cp. The
Java documentation is inconsistent about whether the javac command allows the
-cp abbreviation. On most machines it does, but there are no guarantees.


the problem indeed is the choice itself
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the only reason why the "-cp" option exists is so that you don't have to type the whole long word "-classpath". So it's just for convenience. There are many command-line programs (especially on Unix) that work the same way; they have a short and a long version of the same option.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
-cp is an abbreviation of -classpath.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic