JSE JAVA DISCOVERY - CUT-DOWN EDITION (LINUX)
==============================================
From Lime Software Ltd  |  https://www.jse-license.com  |  hello@jse-license.com
Version 1.0 (2026-11-20)


READ THIS FIRST - WHAT THIS IS, AND WHAT IT IS NOT
--------------------------------------------------
This is a free, CUT-DOWN discovery script. It gives you a quick, indicative list
of the Java installations on ONE Linux machine.

  * It is NOT the JSE-License collection tooling used in a Java Licensing Risk Review.
  * It is NOT an Oracle-verified solution. It is not part of the 3rd Party Tool Vendor
    (3PTV) tooling, and it does not produce a 3PTV statement.
  * Its output is NOT a licence position, a compliance report, or audit evidence.
  * Do NOT send its output to Oracle, or rely on it in an audit or negotiation.
  * It is provided free, as-is, without warranty or support. Test it on a non-production
    machine first, under your own change control.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Lime Software
Ltd is not affiliated with or endorsed by Oracle through this script.


WHAT IT DOES
------------
  * Looks in the usual Java locations: /usr/lib/jvm, /usr/lib64/jvm, /usr/java,
    /usr/local, /opt, /usr/bin, /usr/local/bin, /etc/alternatives, $JAVA_HOME and the
    java found on your PATH. Symbolic links are resolved so each install is listed once.
  * Optionally (switches) looks in per-user locations and any extra folders you name.
  * For each java found, reads the "release" file in the install and, if present, asks the
    package manager (rpm or dpkg, read-only query) which package owns it.
  * Notes which installs have a Java process running right now.
  * Compares each install's version with a built-in table of the latest Oracle update for its
    release line and flags installs that are behind or no longer updated (see PATCH-LEVEL CHECK).
  * Writes two files into the output folder: a CSV of installations and a short summary.

WHAT IT NEVER DOES
------------------
  * Makes no network connections. Nothing is uploaded or sent anywhere.
  * Installs nothing, changes no settings, and writes only to the output folder.
  * Does not read process command lines (they can contain passwords), user names, or file
    contents. Only the program's file path is read.
  * Does not collect CPU, core, socket or virtualisation details.
  * Does not run any Java program unless you add --verify.
  * Does not scan other machines. Run it once per machine.

You can (and should) read the script before running it. It is a plain text file with
comments: java-discovery.sh. Checksums for the download are on the download page.


HOW TO RUN IT
-------------
Requirements: bash 4 or newer (standard on current RHEL/CentOS/Rocky/Alma, Oracle Linux,
Ubuntu, Debian, SUSE), plus the normal find, sed and readlink tools. Root is NOT required,
but without it some folders and other users' processes cannot be read. For the most
complete result, run with sudo if your change process allows.

  1. Unzip the download:

       unzip JSE-Java-Discovery-Linux.zip -d jse-discovery && cd jse-discovery

  2. Run:

       bash ./java-discovery.sh

     (or, with sudo, for the most complete view:  sudo bash ./java-discovery.sh)

  3. Wait for it to finish (usually under a minute or two). Results appear in
     ./JSE-Discovery-Output/

Options:

  -o, --output-dir DIR   Where to write the results (default ./JSE-Discovery-Output)
  -p, --extra-path DIR   Extra folder to search (can be repeated)
      --include-home     Also check ~/.sdkman, ~/.jdks and ~/.gradle/jdks for all users
      --verify           Also RUN each java found with "-XshowSettings:properties -version"
                         to read the vendor/version it reports (only if you are comfortable
                         launching those programs)
  -q, --quiet            No on-screen progress
  -h, --help             Show help

Example:

  sudo bash ./java-discovery.sh --include-home -p /srv/apps -o /tmp/java-results

Running it on many machines: you can deploy it yourself with your configuration management
or orchestration tooling and collect each machine's CSV (for example by pointing -o at a
mounted share). The file names include the host name and time, so results do not overwrite
each other. Please test on a small group first.


PATCH-LEVEL CHECK
-----------------
Each install gets a PatchStatus, compared against the latest Oracle Java SE updates known to
this version of the script (Oracle's 17 November 2026 security update; table dated 2026-11-20):

    8u513   11.0.33.1   17.0.21.1   21.0.13.1   25.0.5.1   27.0.1.1

  Up to date          At or above the latest known update for its release line.
  Behind latest       A newer Oracle update exists. Apply your vendor's latest update.
  No longer updated   The release line (for example 7, 9, 10, 12-16, 18-20, 22-24, 26) gets no further
                      updates from Oracle. Plan a move to a supported release.
  Check               Version could not be confirmed precisely (see the version column).
  Unknown             The version could not be read.

IMPORTANT - what this is, and is not:
  * It is a version comparison only. It is NOT a vulnerability assessment: it does not name
    CVEs, rate severity, or know which vulnerabilities matter in your environment.
  * It works offline from a table inside the script. Oracle now ships security updates
    monthly, so the table goes out of date. The script warns when the table is more than 45
    days old. Check Oracle's Security Baseline page for the current versions.
  * Other vendors (Temurin, Corretto, Azul, Red Hat, Ubuntu and so on) number and time their
    builds differently and may carry fixes under other version numbers. For non-Oracle builds,
    "Behind latest" means "check your vendor's latest update", not "vulnerable".
  * Not being flagged does not mean an install is secure.

THE OUTPUT FILES
----------------
java-discovery-<HOST>-<date-time>.csv           One row per Java installation found.
java-discovery-<HOST>-<date-time>-summary.txt   Counts, run details and these caveats.

CSV columns:
  JavaExecutable / JavaHome   Where it is installed
  Kind                        JDK (has javac) or JRE
  Vendor, Version             From the release file / package manager (or java -version)
  VendorClass                 "Oracle-published", "Other vendor" or "Unknown"
  ReadFrom                    Which source the vendor/version came from
  PatchStatus / LatestKnown   Result of the patch-level check, and the latest known update for that line
  PatchNote                   Plain-English note on the result
  PackageOwner                The rpm/deb package that owns it, if any
  RunningNow                  Number of Java processes running from this install
  DetectedBy                  How the install was found

"Oracle-published" means the install reports Oracle as its vendor. That does NOT by itself
mean you need a licence, or that you do not. Oracle's terms depend on the version, the build,
how Java is used and the agreements you hold. This script cannot make that call.

The CSV lists host names and paths. Treat it as internal information.


LIMITATIONS (PLEASE READ)
-------------------------
  * One machine at a time, common locations only. Java embedded in applications, portable
    copies in unusual folders, containers and other machines will be missed.
  * It does not measure usage, number of employees, processors/cores, or virtualisation,
    and it does not check commercial features. It does not assess vulnerabilities (the patch-level
    check is a version comparison only). Those are what a real licence position
    depends on.
  * A vendor of "Unknown" usually means an install with no release file that was not installed
    from a package. Re-running with --verify often resolves it.
  * Running processes are only visible for processes you have permission to inspect.
  * Results are indicative and may contain errors or omissions.


WHAT NEXT?
----------
  * Small estate (under about 500 machines)? Use the results as a starting point for your own
    review. The guides at https://www.jse-license.com explain Oracle's current Java rules.
  * Larger estate (500+ machines)? Lime Software offers a fixed-fee Java Licensing Risk Review:
    Oracle-verified collection tooling run inside your own network, an analyst-checked
    compliance report, and a 3PTV statement. Nothing leaves your network.
    Book or ask a question: https://www.jse-license.com  |  hello@jse-license.com
    We are happy to sign your NDA first. You do not have to send us this script's output.


LICENCE AND LIABILITY
---------------------
(c) Lime Software Ltd. You may use this script free of charge inside your own organisation.
You may not redistribute modified copies under the Lime Software or JSE-License name.
The script is provided "as is", without warranty of any kind. To the fullest extent
permitted by law, Lime Software Ltd accepts no liability for any loss or damage arising
from its use or from reliance on its output. No support is provided.
