> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Java Exports Directive

The `exports` directive is a statement within the Java Platform Module System (JPMS) used in a `module-info.java` declaration to explicitly expose a specific package to other modules. By default, all packages within a Java module are strongly encapsulated. The `exports` directive overrides this encapsulation, granting compile-time and runtime access to the `public` types residing in the specified package, as well as the `public` and `protected` members (which includes nested types) of those `public` types.

## Unqualified Exports

An unqualified `exports` directive makes the package accessible to any module that *reads* the exporting module. This readability can be established directly via a `requires` declaration or transitively (implied readability) via a `requires transitive` dependency on an intermediary module.

```java theme={"dark"}
module com.example.core {
    // Exposes public types in this package to any reading module
    exports com.example.core.api;
}
```

## Qualified Exports

A qualified `exports` directive restricts package visibility to a specific, comma-separated list of target modules. Modules not explicitly listed in the `to` clause are denied access, even if they read the exporting module.

```java theme={"dark"}
module com.example.core {
    // Exposes the package exclusively to the 'com.example.metrics' and 'com.example.audit' modules
    exports com.example.core.internal to com.example.metrics, com.example.audit;
}
```

## Technical Characteristics

* **Package-Level Granularity:** The directive operates strictly at the package level. You cannot export individual classes or interfaces.
* **Non-Transitive Sub-packages:** Exporting a package does not export its sub-packages. For example, `exports com.example.core;` does not expose `com.example.core.util`. Each package must be exported via its own distinct directive.
* **Access Modifier Enforcement:** The directive only crosses the module boundary. Standard Java access modifiers still apply. Package-private (default) types, as well as `private` or package-private members within an exported package, remain inaccessible to external modules.
* **Reflection Limitations:** While `exports` allows standard reflective access to `public` types, it does not permit deep reflection (e.g., using `setAccessible(true)` to access private fields or methods) from external modules. Deep reflective access requires the `opens` directive instead.
* **Intra-module Access:** The `exports` directive has no effect on code within the same module. All packages within a single module can freely interact with each other, subject only to standard access modifiers.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Java Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
