Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save thebigdatajedi/dcd0f5bebe87b3a371460511b784bd7d to your computer and use it in GitHub Desktop.

Select an option

Save thebigdatajedi/dcd0f5bebe87b3a371460511b784bd7d to your computer and use it in GitHub Desktop.

Revisions

  1. thebigdatajedi created this gist Apr 3, 2024.
    16 changes: 16 additions & 0 deletions Java -version & --version VS. -v & --v.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@

    ###Understanding Java Version Queries

    Java provides specific command-line options to check the installed version. The output can vary slightly based on the Java vendor (Oracle, OpenJDK, etc.) but generally follows a consistent format displaying the version, runtime environment, and VM information.

    Here's a concise key/value pair list of commands you might use to query Java version information, along with the expected type of output for each:

    - `java -version`: This is the correct and standard command to get the Java version, the runtime environment, and VM details. **Expected output:** Detailed version information.

    - `java --version`: This is essentially the same as `java -version` and is accepted by newer versions of Java as a valid command. **Expected output:** Detailed version information, similar to `java -version`.

    - `java -v`: **Expected output:** This command is not recognized by Java, and you will likely receive an error message indicating an unrecognized option.

    - `java --v`: **Expected output:** Similar to `java -v`, this is not a recognized command in Java, and you will receive an error message.

    The commands `java -v` and `java --v` do not provide version information because they are not recognized syntax for querying Java version details. The standardized commands across most Java versions and distributions for obtaining version information are `java -version` and `java --version`.