Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Command line interface

Cédric Belin edited this page Feb 23, 2025 · 3 revisions

Download the latest cli JAR file of Which for Java from the GitHub releases:
https://github.com/cedx/which.java/releases/latest

Then use it to find the instances of an executable command:

$ java -jar which-cli.jar --help

Usage: which [-ahsV] <command>
Find the instances of an executable in the system path.
      <command>   The name of the executable to find.
  -a, --all       List all executable instances found (instead of just the first one).
  -h, --help      Show this help message and exit.
  -s, --silent    Silence the output, just return the exit code (0 if any executable is found, otherwise 404).
  -V, --version   Print version information and exit.

For example:

java -jar which-cli.jar java
# /usr/bin/java

java -jar which-cli.jar --all java
# /usr/bin/java
# /usr/local/bin/java
Clone this wiki locally