This is the problem:

import org.apache.commons.math3;

That's trying to import a package - you can't do that. You have to either use a wildcard import:

import org.apache.commons.math3.*;

or import a specific type:

import org.apache.commons.math3.SomeTypeHere;

In your case it sounds like you actually want:

import org.apache.commons.math3.distribution.EnumeratedIntegerDistribution;

I've tried a sample class with just that import and the jar file downloaded from Apache, and it works fine.

Answer from Jon Skeet on Stack Overflow
🌐
Java-forums
java-forums.org › new-java › 80776-how-import-jar-file.html
how to import jar file
August 11, 2013 - Are you sure the jar file has the missing packages? Have you looked inside the jar (use a zip file utility) to see what it contains? To copy the contents of the command prompt window: Click on Icon in upper left corner Select Edit Select 'Select All' - The selection will show Click in upper left again Select Edit and click 'Copy' Paste here. If you don't understand my response, don't ignore it, ask a question. ... Maybe you supply the wrong jar file name? The Apache Commons library name is prefixed with "commons" not "common".
🌐
Stack Overflow
stackoverflow.com › questions › 57311707 › javac-package-not-found-or-does-not-exist
java - javac package not found or does not exist - Stack Overflow
August 1, 2019 - According to the error message, the problem occurs when tmp\commons.cli\module-info.java is compiled, hence, it is entirely unrelated to your project and the presence of module-info.java indicates that commons.cli is not an automatic module.
🌐
Maven Repository
mvnrepository.com › artifact › commons-cli › commons-cli
Maven Repository: commons-cli » commons-cli
November 13, 2025 - Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface.
Find elsewhere
🌐
GitHub
github.com › apache › commons-cli
GitHub - apache/commons-cli: Apache Commons CLI · GitHub
Apache Commons CLI. Contribute to apache/commons-cli development by creating an account on GitHub.
Starred by 389 users
Forked by 249 users
Languages   Java 97.4% | JavaScript 2.4%
🌐
Apache Commons
commons.apache.org › cli
Apache Commons CLI – Apache Commons CLI
November 8, 2025 - The Apache Commons CLI library provides an API for parsing command-line options passed to an application. It can also print help detailing the options available for that application · Commons CLI supports different types of options:
🌐
Maven Central
central.sonatype.com › artifact › commons-cli › commons-cli
Maven Central: commons-cli:commons-cli
--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-parent</artifactId> <version>91</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.11.0</version> <name>Apache Commons CLI</name> <inceptionYear>2002</inceptionYear> <description> Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface.
🌐
Apache Commons
commons.apache.org › proper › commons-cli › dependency-info.html
Maven Coordinates – Apache Commons CLI
July 30, 2025 - Apache Commons, Apache Commons CLI, Apache, the Apache logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation.
🌐
JetBrains
youtrack.jetbrains.com › issue › IDEA-238891 › Error-java-package-orgapachecommonsio-does-not-exist
Error: java: package org.apache.commons.io does not exist
{{ (>_<) }} This version of your browser is not supported. Try upgrading to the latest stable version. Something went seriously wrong
🌐
Bobcares
bobcares.com › blog › error-package-org-apache-commons-lang-does-not-exist
How to Fix “package org.apache.commons.lang does not exist” Error in Java
December 8, 2024 - The `org.apache.commons.lang` package belongs to the Apache Commons Lang library. If this library is not added to our project dependencies, the Java compiler will throw the “does not exist” error.
🌐
TutorialsPoint
tutorialspoint.com › commons_cli › commons_cli_quick_guide.htm
Apache Commons CLI - Quick Guide
Set the APACHE_HOME environment variable to point to the base directory location where Apache jar is stored on your machine. Assuming, we've extracted commons-cli-1.10.0-bin.zip in Apache folder on various Operating Systems as follows.
🌐
Eclipse
download.eclipse.org › staging › 2026-06 › buildInfo › archive › download.eclipse.org › staging › 2026-06 › index › org.apache.commons.cli_1.11.0.html
org.apache.commons.cli 1.11.0
x.p2.name" value="Apache Commons CLI"/> <property name="org.eclipse.equinox.p2.description" value="Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface."/> <property name="org.eclipse.equinox.p2.provider" value="The Apache Software Foundation"/> <property name="org.eclipse.equinox.p2.doc.url" value="https://commons.apache.org/proper/commons-cli/"/> <property name="maven-groupId" value="commons-cli"/> <property name="maven-artifactId" value="commons-cli"/> <property name="maven-version" value="1.11.0"/> <property name="maven-repository" va