<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vinod Satpute</title>
    <description>The latest articles on DEV Community by Vinod Satpute (@vinod_satpute_888d980bd0a).</description>
    <link>https://dev.to/vinod_satpute_888d980bd0a</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3757036%2Fd0fb51bb-7b35-4fa2-86d7-ed75dfb03999.jpg</url>
      <title>DEV Community: Vinod Satpute</title>
      <link>https://dev.to/vinod_satpute_888d980bd0a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinod_satpute_888d980bd0a"/>
    <language>en</language>
    <item>
      <title>Modules in Java</title>
      <dc:creator>Vinod Satpute</dc:creator>
      <pubDate>Mon, 09 Feb 2026 10:28:31 +0000</pubDate>
      <link>https://dev.to/vinod_satpute_888d980bd0a/modules-in-java-3o5d</link>
      <guid>https://dev.to/vinod_satpute_888d980bd0a/modules-in-java-3o5d</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4d6ccwucxcdep9fzfuh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4d6ccwucxcdep9fzfuh.png" alt="Cover Image" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Modules in Java
&lt;/h2&gt;

&lt;p&gt;Java modules represent a significant shift in the way Java applications are structured, built, and maintained. Introduced in Java 9 as part of the Java Platform Module System (JPMS), modules address long-standing issues related to scalability, maintainability, and security in large codebases. For developers, testers, and automation enthusiasts, mastering Java modules is essential for producing robust, modular applications that are easier to manage and evolve.&lt;/p&gt;

&lt;p&gt;This blog post dives into what Java modules are, why they matter, and how to effectively use them in your projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Modules Matter in Java
&lt;/h2&gt;

&lt;p&gt;Before the introduction of modules, Java applications relied heavily on packages and the classpath for organization. While packages grouped related classes, the classpath offered no strict encapsulation or clear boundaries between different parts of an application or between different applications altogether.&lt;/p&gt;

&lt;p&gt;Some key pain points with pre-module Java environments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Classpath Hell&lt;/strong&gt;: Managing dependencies manually and in large projects often led to conflicts, versioning issues, or accidental usage of internal APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lack of Strong Encapsulation&lt;/strong&gt;: Packages do not enforce strict boundaries. Any public class is accessible anywhere on the classpath.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Difficult Maintenance and Scalability&lt;/strong&gt;: Large monolithic JAR files could grow unwieldy, complicating updates, refactoring, and deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime Performance and Security Issues&lt;/strong&gt;: Eager loading of all classes on the classpath could waste resources or expose internal APIs unintentionally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modules were introduced as a solution to these problems. They enable developers to define clear dependencies and accessibility rules at a higher level than packages, improving code modularity, security, and maintainability.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Module in Java?
&lt;/h2&gt;

&lt;p&gt;A Java module is a self-contained unit of code that explicitly declares which other modules it depends on and which packages it exports to the outside world. This declaration occurs in a special file called &lt;code&gt;module-info.java&lt;/code&gt; inside the module.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Characteristics of a Java Module
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Strong Encapsulation&lt;/strong&gt;: Modules directly control the visibility of packages to other modules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explicit Dependencies&lt;/strong&gt;: Modules declare which other modules they require to function.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved Security&lt;/strong&gt;: Internal APIs can be hidden from outside access.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better Performance&lt;/strong&gt;: The JVM can optimize module loading based on explicit dependencies.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Anatomy of a Java Module
&lt;/h2&gt;

&lt;p&gt;Every Java module includes a descriptor file named &lt;code&gt;module-info.java&lt;/code&gt;. This file lives at the root of the module hierarchy and defines the module’s name, its dependencies, and what it exposes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: &lt;code&gt;module-info.java&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;requires&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;sql&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;requires&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;utils&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;module com.example.myapp&lt;/code&gt;: Defines a module with the name &lt;code&gt;com.example.myapp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;requires java.sql&lt;/code&gt;: Declares a dependency on the &lt;code&gt;java.sql&lt;/code&gt; module.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;requires com.example.utils&lt;/code&gt;: Depends on another custom module.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;exports com.example.myapp.api&lt;/code&gt;: Makes the &lt;code&gt;com.example.myapp.api&lt;/code&gt; package accessible to other modules.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Using Modules: Step-by-Step Guide
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Creating a Module
&lt;/h3&gt;

&lt;p&gt;Start by creating your project directory structure reflecting your module name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myapp/
 └─ src/
     └─ com.example.myapp/
         ├─ module-info.java
         └─ com/
             └─ example/
                 └─ myapp/
                     └─ Main.java
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;module-info.java&lt;/code&gt; defines the module metadata, while your Java code resides inside the package directories.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Writing the Module Descriptor
&lt;/h3&gt;

&lt;p&gt;Define dependencies and exports in &lt;code&gt;module-info.java&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;requires&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;base&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Implicitly required, but can be stated explicitly&lt;/span&gt;
    &lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Compiling Modules
&lt;/h3&gt;

&lt;p&gt;Compile your module using the &lt;code&gt;javac&lt;/code&gt; compiler with the module path option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;javac &lt;span class="nt"&gt;-d&lt;/span&gt; out &lt;span class="nt"&gt;--module-source-path&lt;/span&gt; src &lt;span class="si"&gt;$(&lt;/span&gt;find src &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*.java"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This compiles all modules found under the &lt;code&gt;src&lt;/code&gt; directory and places their output in the &lt;code&gt;out&lt;/code&gt; directory.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Running Modular Applications
&lt;/h3&gt;

&lt;p&gt;Run your modular application specifying the module and main class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;--module-path&lt;/span&gt; out &lt;span class="nt"&gt;-m&lt;/span&gt; com.example.myapp/com.example.myapp.Main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Practical Examples of Modules
&lt;/h2&gt;

&lt;p&gt;Let’s consider a simple project with two modules: &lt;code&gt;com.example.utils&lt;/code&gt; and &lt;code&gt;com.example.myapp&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Module: com.example.utils
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;module-info.java:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;utils&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;utils&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;TextUtils.java:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;package&lt;/span&gt; &lt;span class="nn"&gt;com.example.utils.text&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TextUtils&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toUpperCase&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Module: com.example.myapp
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;module-info.java:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;requires&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;utils&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Main.java:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;package&lt;/span&gt; &lt;span class="nn"&gt;com.example.myapp.api&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;com.example.utils.text.TextUtils&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TextUtils&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toUpperCase&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello modules"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;com.example.myapp&lt;/code&gt; depends on &lt;code&gt;com.example.utils&lt;/code&gt; but only exposes its own API package.&lt;/p&gt;




&lt;h2&gt;
  
  
  Advantages of Using Java Modules
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Better Maintainability
&lt;/h3&gt;

&lt;p&gt;Modules enforce strong encapsulation by default, making code easier to maintain over time. Internal implementation details are hidden, so changes inside a module often do not affect other modules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Improved Security
&lt;/h3&gt;

&lt;p&gt;Since modules do not expose internal packages unless explicitly exported, sensitive internal APIs remain inaccessible, reducing the attack surface.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clarity of Dependencies
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;module-info.java&lt;/code&gt; clearly states what dependencies each module requires, simplifying build and deployment processes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simplified Large-Scale Projects
&lt;/h3&gt;

&lt;p&gt;Modules break monolithic JARs into smaller, reusable components. Teams can work independently on different modules, fostering better collaboration.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Challenges and Best Practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Dealing with Split Packages
&lt;/h3&gt;

&lt;p&gt;A split package occurs when two modules export the same package name. This is not allowed in the module system and leads to runtime errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best practice:&lt;/strong&gt; Avoid split packages by reorganizing code so that each package is owned by exactly one module.&lt;/p&gt;

&lt;h3&gt;
  
  
  Migrating Legacy Projects
&lt;/h3&gt;

&lt;p&gt;Legacy Java projects often have monolithic codebases without module descriptors. Migration requires careful planning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start by modularizing at a high level.&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;--patch-module&lt;/code&gt; option during transition.&lt;/li&gt;
&lt;li&gt;Gradually add &lt;code&gt;module-info.java&lt;/code&gt; files to key modules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Module Naming Conventions
&lt;/h3&gt;

&lt;p&gt;Module names should follow reverse domain name conventions (e.g., &lt;code&gt;com.company.project&lt;/code&gt;). This avoids conflicts and ensures uniqueness.&lt;/p&gt;




&lt;h2&gt;
  
  
  Modules and Testing
&lt;/h2&gt;

&lt;p&gt;Testing modular applications requires ensuring test code can access the modules under test.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing Approaches
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use &lt;code&gt;opens&lt;/code&gt; Directive in Module:&lt;/strong&gt; To allow reflection-based testing frameworks such as JUnit to access non-exported packages.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;opens&lt;/span&gt; &lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;internal&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;junit&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;platform&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;commons&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Create Test Modules:&lt;/strong&gt; Tests can be organized in separate modules that declare &lt;code&gt;requires&lt;/code&gt; on the modules they test.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Java modules introduce a modern, scalable approach to organizing applications and libraries. They resolve many longstanding challenges around dependency management, encapsulation, and security. By explicitly declaring dependencies and controlling package exports, modules enhance code clarity, maintainability, and runtime performance.&lt;/p&gt;

&lt;p&gt;For developers and testers, embracing the module system offers a structured foundation for building reliable and modular Java applications. Starting with proper module descriptor files and understanding the JVM’s module requirements will ensure your projects are future-proof and easier to manage.&lt;/p&gt;

&lt;p&gt;As you adopt modules, focus on clear dependencies, avoid split packages, and leverage the module system to safeguard your internal APIs. This will result in cleaner codebases, smoother collaboration, and improved application robustness.&lt;/p&gt;

</description>
      <category>java</category>
      <category>modules</category>
    </item>
  </channel>
</rss>
