Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 512355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:18:41+00:00 2026-05-13T07:18:41+00:00

On the commandline is java -cp simply an abbreviation for java -classpath ? (I

  • 0

On the commandline
is java -cp simply an abbreviation for java -classpath?

(I seem to remember they may have different behaviour but can’t find explicit documentation).

UPDATE Thanks (@AlBlue) for confirming that my memory was in fact correct and that they used to be different.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:18:41+00:00Added an answer on May 13, 2026 at 7:18 am

    They used to be different, but now they’re the same (hence accepting both for compatibility). Originally, -classpath needed to have the classes.zip (Java 1.0/1.1) or rt.jar (Java 1.2+) in order to be able to function. Therefore, if you ran -classpath my.jar, it wouldn’t work (since it wouldn’t find java.lang.Object and friends). As a result, -cp was added which would append the classpaths/jars to the list, but not overwriting the classes.zip/rt.jar entry.

    However, this behaviour changed sometime (1.4? 1.5?) so that you no longer needed to put entries on the ‘system’ classpath via -classpath, after which they were identical.

    You could probably run commands from the 1.3 or 1.4 era (if you still have them) to verify when the change occurred.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple java program that runs fine in eclipse but cannot find
I've searched around and I can't find a simple commandline tool that will take
I have done this before but seem to be having a brain freeze and
I may have multiple questions here, but ultimately I'm trying to compile and run
From Java, is it possible to get the complete commandline with all arguments that
I have written a Java program which I package and run from a JAR
I'm trying to build my Flex/Java web app from within IntelliJ rather than have
I have a relatively small Java library that implements a few dozen beans (no
I have a simple java application that loads a properties file from the current
I have a Windows Service (written in Java) that needs to start other Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.